diff options
author | Eric Wong <e@80x24.org> | 2023-01-17 07:19:10 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-01-18 23:26:03 +0000 |
commit | 4a2a95bbc78f99c8c5278cfe29de74bd1483903c (patch) | |
tree | 8652affab199e745cb52da49f526a2d998e755fb /lib/PublicInbox/LeiStore.pm | |
parent | f7f0e7bee09cfc57ecc6845a8cf9e80a0bbd64f5 (diff) | |
download | public-inbox-4a2a95bbc78f99c8c5278cfe29de74bd1483903c.tar.gz |
This avoids awkwardly stuffing an arrayref into callbacks which expect multiple arguments. IPC->awaitpid_init now allows pre-registering callbacks before spawning workers.
Diffstat (limited to 'lib/PublicInbox/LeiStore.pm')
-rw-r--r-- | lib/PublicInbox/LeiStore.pm | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/PublicInbox/LeiStore.pm b/lib/PublicInbox/LeiStore.pm index 57f0e013..0ecf1388 100644 --- a/lib/PublicInbox/LeiStore.pm +++ b/lib/PublicInbox/LeiStore.pm @@ -604,9 +604,8 @@ sub recv_and_run { $self->SUPER::recv_and_run(@args); } -sub _sto_atexit { # dwaitpid callback - my ($args, $pid) = @_; - my $self = $args->[0]; +sub _sto_atexit { # awaitpid cb (via awaitpid_init) + my ($pid, $sto) = @_; warn "lei/store PID:$pid died \$?=$?\n" if $?; } @@ -621,12 +620,12 @@ sub write_prepare { # Mail we import into lei are private, so headers filtered out # by -mda for public mail are not appropriate local @PublicInbox::MDA::BAD_HEADERS = (); + $self->awaitpid_init(\&_sto_atexit); # outlives $lei $self->wq_workers_start("lei/store $dir", 1, $lei->oldset, { lei => $lei, -err_wr => $w, to_close => [ $r ], }); - $self->wq_wait_async(\&_sto_atexit); # outlives $lei require PublicInbox::LeiStoreErr; PublicInbox::LeiStoreErr->new($r, $lei); } |