about summary refs log tree commit homepage
path: root/lib/PublicInbox/LEI.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-10-08 18:54:03 +0000
committerEric Wong <e@80x24.org>2023-10-08 18:54:42 +0000
commitc8b757d945040426f8c4cd909c2f05e34be6ccb1 (patch)
tree760cd0f1e7e67961cc65cec13a181eda8c345ff5 /lib/PublicInbox/LEI.pm
parente522fd43913f26db5b99f2417a0d863439634ff5 (diff)
downloadpublic-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/LEI.pm')
-rw-r--r--lib/PublicInbox/LEI.pm9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index 1ba2c2a1..e2b3c0d9 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -1537,12 +1537,11 @@ sub lms {
 
 sub sto_done_request {
         my ($lei, $wq) = @_;
-        return unless $lei->{sto};
+        return unless $lei->{sto} && $lei->{sto}->{-wq_s1};
         local $current_lei = $lei;
-        my $sock = $wq ? $wq->{lei_sock} : undef;
-        $sock //= $lei->{sock};
-        my @io;
-        push(@io, $sock) if $sock; # async wait iff possible
+        my $s = ($wq ? $wq->{lei_sock} : undef) // $lei->{sock};
+        my $errfh = $lei->{2} // *STDERR{GLOB};
+        my @io = $s ? ($errfh, $s) : ($errfh);
         eval { $lei->{sto}->wq_io_do('done', \@io) };
         warn($@) if $@;
 }