diff options
author | Eric Wong <e@80x24.org> | 2023-10-04 03:49:17 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-10-04 17:46:33 +0000 |
commit | 398392e62ae4790f28b74ff92494a906061c837f (patch) | |
tree | 63cebb059c257a5d9d91660c61eb85b722678b0a /lib/PublicInbox/DirIdle.pm | |
parent | 4b3e8437ecf20493e601a30cbbb8ea1ce73deb82 (diff) | |
download | public-inbox-398392e62ae4790f28b74ff92494a906061c837f.tar.gz |
We don't want FS activity to delay lei-daemon shutdown.
Diffstat (limited to 'lib/PublicInbox/DirIdle.pm')
-rw-r--r-- | lib/PublicInbox/DirIdle.pm | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/PublicInbox/DirIdle.pm b/lib/PublicInbox/DirIdle.pm index af99811c..de6f229b 100644 --- a/lib/PublicInbox/DirIdle.pm +++ b/lib/PublicInbox/DirIdle.pm @@ -68,10 +68,16 @@ sub rm_watches { } } +sub close { + my ($self) = @_; + delete $self->{cb}; + $self->SUPER::close; # if using real kevent/inotify +} + sub event_step { my ($self) = @_; - my $cb = $self->{cb}; - local $PublicInbox::DS::in_loop = 0; # waitpid() synchronously + my $cb = $self->{cb} or return; + local $PublicInbox::DS::in_loop = 0; # waitpid() synchronously (FIXME) eval { my @events = $self->{inot}->read; # Linux::Inotify2->read $cb->($_) for @events; @@ -83,7 +89,7 @@ sub force_close { my ($self) = @_; my $inot = delete $self->{inot} // return; if ($inot->can('fh')) { # Linux::Inotify2 2.3+ - close($inot->fh) or warn "CLOSE ERROR: $!"; + CORE::close($inot->fh) or warn "CLOSE ERROR: $!"; } elsif ($inot->isa('Linux::Inotify2')) { require PublicInbox::LI2Wrap; PublicInbox::LI2Wrap::wrapclose($inot); |