* [PATCH 0/7] lei bugfixes and other fixes
@ 2021-09-22 2:24 7% Eric Wong
2021-09-22 2:24 6% ` [PATCH 7/7] lei: drop redundant WQ EOF callbacks Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-09-22 2:24 UTC (permalink / raw)
To: meta
How did I forget 2/7 for all these months? :<
6/7 took a while for me to figure out, I only noticed it
because of background processes running after MUA exit
(from "lei up --mua=... MFOLDER"), but I got 4/7 and 7/7
fixes out of it.
Eric Wong (7):
ipc: do not add "0" to $0 of solo workers
treewide: fix %SIG localization, harder
script/lei: describe purpose of sleep loop
lei: dclose: do not close unnecessarily
inbox: do not waste hash slot on httpbackend_limiter
lei up: avoid excessively parallel --all
lei: drop redundant WQ EOF callbacks
lib/PublicInbox/Admin.pm | 2 +-
lib/PublicInbox/ExtSearchIdx.pm | 4 +-
lib/PublicInbox/IPC.pm | 7 +--
lib/PublicInbox/Inbox.pm | 10 ++--
lib/PublicInbox/LEI.pm | 3 +-
lib/PublicInbox/LeiImportKw.pm | 8 +--
lib/PublicInbox/LeiMirror.pm | 10 +---
lib/PublicInbox/LeiNoteEvent.pm | 8 +--
lib/PublicInbox/LeiPmdir.pm | 8 +--
lib/PublicInbox/LeiUp.pm | 86 +++++++++++++++++++++------------
lib/PublicInbox/TestCommon.pm | 3 +-
lib/PublicInbox/Watch.pm | 4 +-
lib/PublicInbox/Xapcmd.pm | 8 +--
script/lei | 2 +-
script/public-inbox-clone | 2 +-
t/run.perl | 1 +
16 files changed, 86 insertions(+), 80 deletions(-)
^ permalink raw reply [relevance 7%]
* [PATCH 7/7] lei: drop redundant WQ EOF callbacks
2021-09-22 2:24 7% [PATCH 0/7] lei bugfixes and other fixes Eric Wong
@ 2021-09-22 2:24 6% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-09-22 2:24 UTC (permalink / raw)
To: meta
Redundant code is noise and therefore confusing :<
---
lib/PublicInbox/LeiImportKw.pm | 8 +-------
lib/PublicInbox/LeiMirror.pm | 10 ++--------
lib/PublicInbox/LeiNoteEvent.pm | 8 +-------
lib/PublicInbox/LeiPmdir.pm | 8 +-------
script/public-inbox-clone | 2 +-
5 files changed, 6 insertions(+), 30 deletions(-)
diff --git a/lib/PublicInbox/LeiImportKw.pm b/lib/PublicInbox/LeiImportKw.pm
index 21c93515..c35c5c26 100644
--- a/lib/PublicInbox/LeiImportKw.pm
+++ b/lib/PublicInbox/LeiImportKw.pm
@@ -46,17 +46,11 @@ sub ck_update_kw { # via wq_io_do
$self->{sto}->wq_do('set_eml_vmd', undef, { kw => $kw }, \@docids);
}
-sub ikw_done_wait {
- my ($arg, $pid) = @_;
- my ($self, $lei) = @$arg;
- $lei->can('wq_done_wait')->($arg, $pid);
-}
-
sub _lei_wq_eof { # EOF callback for main lei daemon
my ($lei) = @_;
my $ikw = delete $lei->{ikw} or return $lei->fail;
$lei->sto_done_request($ikw->{lei_sock});
- $ikw->wq_wait_old(\&ikw_done_wait, $lei);
+ $ikw->wq_wait_old($lei->can('wq_done_wait'), $lei);
}
1;
diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm
index d9c13f05..6bfa4b6f 100644
--- a/lib/PublicInbox/LeiMirror.pm
+++ b/lib/PublicInbox/LeiMirror.pm
@@ -11,7 +11,7 @@ use PublicInbox::Spawn qw(popen_rd spawn run_die);
use File::Temp ();
use Fcntl qw(SEEK_SET O_CREAT O_EXCL O_WRONLY);
-sub do_finish_mirror { # dwaitpid callback
+sub _wq_done_wait { # dwaitpid callback (via wq_eof)
my ($arg, $pid) = @_;
my ($mrr, $lei) = @$arg;
my $f = "$mrr->{dst}/mirror.done";
@@ -28,12 +28,6 @@ sub do_finish_mirror { # dwaitpid callback
$lei->dclose;
}
-sub _lei_wq_eof { # EOF callback for main daemon
- my ($lei) = @_;
- my $mrr = delete $lei->{wq1} or return $lei->fail;
- $mrr->wq_wait_old(\&do_finish_mirror, $lei);
-}
-
# for old installations without manifest.js.gz
sub try_scrape {
my ($self) = @_;
@@ -176,7 +170,7 @@ sub index_cloned_inbox {
PublicInbox::Admin::progress_prepare($opt, $lei->{2});
PublicInbox::Admin::index_inbox($ibx, undef, $opt);
}
- open my $x, '>', "$self->{dst}/mirror.done"; # for do_finish_mirror
+ open my $x, '>', "$self->{dst}/mirror.done"; # for _wq_done_wait
}
sub run_reap {
diff --git a/lib/PublicInbox/LeiNoteEvent.pm b/lib/PublicInbox/LeiNoteEvent.pm
index 43d5ed0f..d2429485 100644
--- a/lib/PublicInbox/LeiNoteEvent.pm
+++ b/lib/PublicInbox/LeiNoteEvent.pm
@@ -107,17 +107,11 @@ sub ipc_atfork_child {
$self->SUPER::ipc_atfork_child;
}
-sub lne_done_wait {
- my ($arg, $pid) = @_;
- my ($self, $lei) = @$arg;
- $lei->can('wq_done_wait')->($arg, $pid);
-}
-
sub _lei_wq_eof { # EOF callback for main lei daemon
my ($lei) = @_;
my $lne = delete $lei->{lne} or return $lei->fail;
$lei->sto_done_request;
- $lne->wq_wait_old(\&lne_done_wait, $lei);
+ $lne->wq_wait_old($lei->can('wq_done_wait'), $lei);
}
1;
diff --git a/lib/PublicInbox/LeiPmdir.pm b/lib/PublicInbox/LeiPmdir.pm
index 23bccb4f..2d3b9755 100644
--- a/lib/PublicInbox/LeiPmdir.pm
+++ b/lib/PublicInbox/LeiPmdir.pm
@@ -47,17 +47,11 @@ sub mdir_iter { # via wq_io_do
$self->{ipt}->pmdir_cb($f, $fl, @args);
}
-sub pmd_done_wait {
- my ($arg, $pid) = @_;
- my ($self, $lei) = @$arg;
- $lei->can('wq_done_wait')->($arg, $pid);
-}
-
sub _lei_wq_eof { # EOF callback for main lei daemon
my ($lei) = @_;
my $pmd = delete $lei->{pmd} or return $lei->fail;
$lei->sto_done_request($pmd->{lei_sock});
- $pmd->wq_wait_old(\&pmd_done_wait, $lei);
+ $pmd->wq_wait_old($lei->can('wq_done_wait'), $lei);
}
1;
diff --git a/script/public-inbox-clone b/script/public-inbox-clone
index 2b18969f..0efde1a8 100755
--- a/script/public-inbox-clone
+++ b/script/public-inbox-clone
@@ -54,5 +54,5 @@ my $mrr = bless {
dst => $dst,
}, 'PublicInbox::LeiMirror';
$mrr->do_mirror;
-$mrr->can('do_finish_mirror')->([$mrr, $lei], $$);
+$mrr->can('_wq_done_wait')->([$mrr, $lei], $$);
exit(($lei->{child_error} // 0) >> 8);
^ permalink raw reply related [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-09-22 2:24 7% [PATCH 0/7] lei bugfixes and other fixes Eric Wong
2021-09-22 2:24 6% ` [PATCH 7/7] lei: drop redundant WQ EOF callbacks 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).