]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei: ensure refresh_watches isn't called from workers
authorEric Wong <e@80x24.org>
Sun, 26 Sep 2021 05:38:19 +0000 (22:38 -0700)
committerEric Wong <e@80x24.org>
Sun, 26 Sep 2021 08:19:19 +0000 (08:19 +0000)
Only the top-level lei-daemon will do inotify/kevent.

lib/PublicInbox/LEI.pm

index a337fb0d80c228ab70e2e7014a16164b6deb259f..8faf74a29466f84bf55c59aaab685051bb300a6b 100644 (file)
@@ -578,6 +578,7 @@ sub _lei_atfork_child {
        close $listener if $listener;
        undef $listener;
        $dir_idle->force_close if $dir_idle;
+       undef $dir_idle;
        %PATH2CFG = ();
        $MDIR2CFGPATH = {};
        eval 'no warnings; undef $PublicInbox::LeiNoteEvent::to_flush';
@@ -1413,6 +1414,7 @@ sub add_maildir_watch ($$) {
 
 sub refresh_watches {
        my ($lei) = @_;
+       $dir_idle or return;
        my $cfg = _lei_cfg($lei) or return;
        my $old = $cfg->{-watches};
        my $watches = $cfg->{-watches} //= {};