diff options
author | Eric Wong <e@80x24.org> | 2023-10-08 18:54:03 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-10-08 18:54:42 +0000 |
commit | c8b757d945040426f8c4cd909c2f05e34be6ccb1 (patch) | |
tree | 760cd0f1e7e67961cc65cec13a181eda8c345ff5 /lib/PublicInbox/LeiStore.pm | |
parent | e522fd43913f26db5b99f2417a0d863439634ff5 (diff) | |
download | public-inbox-c8b757d945040426f8c4cd909c2f05e34be6ccb1.tar.gz |
It's safer against deadlocks and we still get proper error reporting by passing stderr across in addition to the lei socket.
Diffstat (limited to 'lib/PublicInbox/LeiStore.pm')
-rw-r--r-- | lib/PublicInbox/LeiStore.pm | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/PublicInbox/LeiStore.pm b/lib/PublicInbox/LeiStore.pm index 0cb78f79..e19ec88e 100644 --- a/lib/PublicInbox/LeiStore.pm +++ b/lib/PublicInbox/LeiStore.pm @@ -582,19 +582,20 @@ sub xchg_stderr { } sub done { - my ($self, $sock_ref) = @_; - my $err = ''; + my ($self) = @_; + my ($errfh, $lei_sock) = @$self{0, 1}; # via sto_done_request + my @err; if (my $im = delete($self->{im})) { eval { $im->done }; - if ($@) { - $err .= "import done: $@\n"; - warn $err; - } + push(@err, "E: import done: $@\n") if $@; } delete $self->{lms}; - $self->{priv_eidx}->done; # V2Writable::done + eval { $self->{priv_eidx}->done }; # V2Writable::done + push(@err, "E: priv_eidx done: $@\n") if $@; + print { $errfh // *STDERR{GLOB} } @err; + send($lei_sock, 'child_error 256', 0) if @err && $lei_sock; xchg_stderr($self); - die $err if $err; + die @err if @err; } sub ipc_atfork_child { |