From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 2/6] inboxidle: remove needless check for {inboxdir}
Date: Sun, 20 Dec 2020 06:30:12 +0000 [thread overview]
Message-ID: <20201220063016.20959-3-e@80x24.org> (raw)
In-Reply-To: <20201220063016.20959-1-e@80x24.org>
->each_inbox will never attempt to iterate an object
without {inboxdir}, and simplify + short-circuit the
corresponding code
---
lib/PublicInbox/Config.pm | 7 +++----
lib/PublicInbox/InboxIdle.pm | 7 +------
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index cafd9c3b..199ce019 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -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\.//;
diff --git a/lib/PublicInbox/InboxIdle.pm b/lib/PublicInbox/InboxIdle.pm
index 2737bbbd..f1cbc012 100644
--- a/lib/PublicInbox/InboxIdle.pm
+++ b/lib/PublicInbox/InboxIdle.pm
@@ -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} //= [];
next prev parent reply other threads:[~2020-12-20 6:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-20 6:30 [PATCH 0/6] path usability and some tiny cleanups Eric Wong
2020-12-20 6:30 ` [PATCH 1/6] script/public-inbox-*: favor caller-provided pathnames Eric Wong
2020-12-20 6:30 ` Eric Wong [this message]
2020-12-20 6:30 ` [PATCH 3/6] daemon: lazy load Cwd only for --daemonize users Eric Wong
2020-12-20 6:30 ` [PATCH 4/6] daemon: unconditionally call IO::Handle::blocking(0) Eric Wong
2020-12-20 6:30 ` [PATCH 5/6] daemon: kill_workers: eliminate unnecessary loop Eric Wong
2020-12-20 6:30 ` [PATCH 6/6] config: eliminate unnecessary join call up front Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201220063016.20959-3-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).