From a1733d3406dfbde52d1468e671edd1d76893f546 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 15 Oct 2021 13:30:55 +0000 Subject: lei + ipc: simplify process reaping 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. --- lib/PublicInbox/LeiNoteEvent.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox/LeiNoteEvent.pm') diff --git a/lib/PublicInbox/LeiNoteEvent.pm b/lib/PublicInbox/LeiNoteEvent.pm index 1b714dae..ba4dfd49 100644 --- a/lib/PublicInbox/LeiNoteEvent.pm +++ b/lib/PublicInbox/LeiNoteEvent.pm @@ -14,7 +14,7 @@ our $to_flush; # { cfgpath => $lei } sub flush_lei ($) { my ($lei) = @_; my $lne = delete $lei->{cfg}->{-lei_note_event}; - $lne->wq_close(1, undef, $lei) if $lne; # runs _lei_wq_eof; + $lne->wq_close if $lne; # runs _lei_wq_eof; } # we batch up writes and flush every 5s (matching Linux default @@ -111,9 +111,8 @@ sub ipc_atfork_child { sub _lei_wq_eof { # EOF callback for main lei daemon my ($lei) = @_; - my $lne = delete $lei->{lne} or return $lei->fail; + delete $lei->{lne} or return $lei->fail; $lei->sto_done_request; - $lne->wq_wait_old($lei->can('wq_done_wait'), $lei); } 1; -- cgit v1.2.3-24-ge0c7