user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 2/6] inboxidle: remove needless check for {inboxdir}
  2020-12-20  6:30  6% [PATCH 0/6] path usability and some tiny cleanups Eric Wong
@ 2020-12-20  6:30  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-12-20  6:30 UTC (permalink / raw)
  To: meta

->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} //= [];
 

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/6] path usability and some tiny cleanups
@ 2020-12-20  6:30  6% Eric Wong
  2020-12-20  6:30  7% ` [PATCH 2/6] inboxidle: remove needless check for {inboxdir} Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-12-20  6:30 UTC (permalink / raw)
  To: meta

1/6 makes some (IMHO) important usability improvements to
existing commands.  The rest are some yak-shaving while
I attempt to speed up config handling with thousands of
inboxes...

Eric Wong (6):
  script/public-inbox-*: favor caller-provided pathnames
  inboxidle: remove needless check for {inboxdir}
  daemon: lazy load Cwd only for --daemonize users
  daemon: unconditionally call IO::Handle::blocking(0)
  daemon: kill_workers: eliminate unnecessary loop
  config: eliminate unnecessary join call up front

 lib/PublicInbox/Admin.pm     | 102 +++++++++++++++++++++++------------
 lib/PublicInbox/Config.pm    |  14 +++--
 lib/PublicInbox/Daemon.pm    |  17 +++---
 lib/PublicInbox/InboxIdle.pm |   7 +--
 script/public-inbox-convert  |  27 +++-------
 script/public-inbox-init     |  10 +---
 t/admin.t                    |  16 +++---
 7 files changed, 100 insertions(+), 93 deletions(-)

^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-12-20  6:30  6% [PATCH 0/6] path usability and some tiny cleanups Eric Wong
2020-12-20  6:30  7% ` [PATCH 2/6] inboxidle: remove needless check for {inboxdir} Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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).