]> Sergey Matveev's repositories - public-inbox.git/commitdiff
inboxidle: remove needless check for {inboxdir}
authorEric Wong <e@80x24.org>
Sun, 20 Dec 2020 06:30:12 +0000 (06:30 +0000)
committerEric Wong <e@80x24.org>
Sun, 20 Dec 2020 20:39:11 +0000 (20:39 +0000)
->each_inbox will never attempt to iterate an object
without {inboxdir}, and simplify + short-circuit the
corresponding code

lib/PublicInbox/Config.pm
lib/PublicInbox/InboxIdle.pm

index cafd9c3bafe364eaaeedcb478cc9e23fd1a49dfc..199ce0193bbd00cda7389d1ca918e0857cbac4c5 100644 (file)
@@ -391,9 +391,9 @@ EOF
                }
        }
 
-       # backwards compatibility:
-       $ibx->{inboxdir} //= $self->{"$pfx.mainrepo"};
-       if (($ibx->{inboxdir} // '') =~ /\n/s) {
+       # "mainrepo" is backwards compatibility:
+       $ibx->{inboxdir} //= $self->{"$pfx.mainrepo"} // return;
+       if ($ibx->{inboxdir} =~ /\n/s) {
                warn "E: `$ibx->{inboxdir}' must not contain `\\n'\n";
                return;
        }
@@ -415,7 +415,6 @@ EOF
                }
        }
 
-       return unless defined($ibx->{inboxdir});
        my $name = $pfx;
        $name =~ s/\Apublicinbox\.//;
 
index 2737bbbd01fbde2583de42f97f3383098a428999..f1cbc012f2bc6bb3bfb6420082282e2ea919d97f 100644 (file)
@@ -7,7 +7,6 @@
 package PublicInbox::InboxIdle;
 use strict;
 use parent qw(PublicInbox::DS);
-use Cwd qw(abs_path);
 use PublicInbox::Syscall qw(EPOLLIN EPOLLET);
 my $IN_MODIFY = 0x02; # match Linux inotify
 my $ino_cls;
@@ -22,11 +21,7 @@ require PublicInbox::In2Tie if $ino_cls;
 
 sub in2_arm ($$) { # PublicInbox::Config::each_inbox callback
        my ($ibx, $self) = @_;
-       my $dir = abs_path($ibx->{inboxdir});
-       if (!defined($dir)) {
-               warn "W: $ibx->{inboxdir} not watched: $!\n";
-               return;
-       }
+       my $dir = $ibx->{inboxdir};
        my $inot = $self->{inot};
        my $cur = $self->{pathmap}->{$dir} //= [];