diff options
author | Eric Wong <e@80x24.org> | 2021-10-15 13:30:55 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-10-15 15:58:24 +0000 |
commit | a1733d3406dfbde52d1468e671edd1d76893f546 (patch) | |
tree | 118763410e5c6f32776671a435595792f0555ee4 /lib/PublicInbox/LeiToMail.pm | |
parent | 2ca12a7fd78d7c9c27fec4f50fdcb58f9c838003 (diff) | |
download | public-inbox-a1733d3406dfbde52d1468e671edd1d76893f546.tar.gz |
Simplify our APIs and force dwaitpid() to work in async mode for all lei workers. This avoids having lingering zombies for parallel searches if one worker finishes soon before another. The old distinction between "old" and "new" workers was needlessly complex, error-prone, and embarrasingly bad. We also never handled v2:// writers properly before on Ctrl-C/Ctrl-Z (SIGINT/SIGTSTP), so add them to @WQ_KEYS to ensure they get handled by $lei when appropropriate.
Diffstat (limited to 'lib/PublicInbox/LeiToMail.pm')
-rw-r--r-- | lib/PublicInbox/LeiToMail.pm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm index 9c748dea..76e103c7 100644 --- a/lib/PublicInbox/LeiToMail.pm +++ b/lib/PublicInbox/LeiToMail.pm @@ -637,6 +637,12 @@ sub _do_augment_mbox { $dedupe->pause_dedupe if $dedupe; } +sub v2w_done_wait { # dwaitpid callback + my ($arg, $pid) = @_; + my ($v2w, $lei) = @$arg; + $lei->child_error($?, "error for $v2w->{ibx}->{inboxdir}") if $?; +} + sub _pre_augment_v2 { my ($self, $lei) = @_; my $dir = $self->{dst}; @@ -659,8 +665,8 @@ sub _pre_augment_v2 { PublicInbox::InboxWritable->new($ibx, @creat); $ibx->init_inbox if @creat; my $v2w = $ibx->importer; - $v2w->{-wq_no_bcast} = 1; $v2w->wq_workers_start("lei/v2w $dir", 1, $lei->oldset, {lei => $lei}); + $v2w->wq_wait_async(\&v2w_done_wait, $lei); $lei->{v2w} = $v2w; return if !$lei->{opt}->{shared}; my $d = "$lei->{ale}->{git}->{git_dir}/objects"; @@ -811,7 +817,7 @@ sub net_merge_all_done { $self->{dst}, \$self->{-au_noted}); } $self->wq_broadcast('do_post_auth'); - $self->wq_close(1); + $self->wq_close; } 1; |