]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LEI.pm
lei: golf PATH2CFG cleanup
[public-inbox.git] / lib / PublicInbox / LEI.pm
index 7dfd33989186d479c9f1b796599e29ff52d49fc1..e7f37efaf0a3231851eb3307184878ab0166a9c8 100644 (file)
@@ -850,9 +850,7 @@ sub _lei_cfg ($;$) {
        }
        if (scalar(keys %PATH2CFG) > 5) {
                # FIXME: use inotify/EVFILT_VNODE to detect unlinked configs
-               for my $k (keys %PATH2CFG) {
-                       delete($PATH2CFG{$k}) unless -f $k
-               }
+               delete(@PATH2CFG{grep(!-f, keys %PATH2CFG)});
        }
        $self->{cfg} = $PATH2CFG{$f} = $cfg;
        refresh_watches($self);
@@ -1305,10 +1303,11 @@ sub lazy_start {
                USR2 => \&noop,
        };
        require PublicInbox::DirIdle;
-       local $dir_idle = PublicInbox::DirIdle->new([$sock_dir], sub {
+       local $dir_idle = PublicInbox::DirIdle->new(sub {
                # just rely on wakeup to hit PostLoopCallback set below
                dir_idle_handler($_[0]) if $_[0]->fullname ne $path;
-       }, 1);
+       });
+       $dir_idle->add_watches([$sock_dir]);
        PublicInbox::DS->SetPostLoopCallback(sub {
                my ($dmap, undef) = @_;
                if (@st = defined($path) ? stat($path) : ()) {