* [PATCH 2/4] qspawn: psgi_qx: do not call async_pass on errors
2023-01-19 20:32 5% [PATCH 0/4] qspawn|awaitpid error handling improvements Eric Wong
@ 2023-01-19 20:32 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-01-19 20:32 UTC (permalink / raw)
To: meta
This makes control flow slightly less confusing.
---
lib/PublicInbox/Qspawn.pm | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/lib/PublicInbox/Qspawn.pm b/lib/PublicInbox/Qspawn.pm
index c4708c0f..de74b174 100644
--- a/lib/PublicInbox/Qspawn.pm
+++ b/lib/PublicInbox/Qspawn.pm
@@ -142,20 +142,20 @@ sub start ($$$) {
sub psgi_qx_init_cb { # this may be PublicInbox::HTTPD::Async {cb}
my ($self) = @_;
- my $async = delete $self->{async}; # PublicInbox::HTTPD::Async
my ($r, $buf);
- my $qx_fh = $self->{qx_fh};
reread:
$r = sysread($self->{rpipe}, $buf, 65536);
- if ($async) {
- $async->async_pass($self->{psgi_env}->{'psgix.io'},
- $qx_fh, \$buf);
- } elsif (defined $r) {
- $r ? (print $qx_fh $buf) : event_step($self, undef);
- } else {
+ if (!defined($r)) {
return if $! == EAGAIN; # try again when notified
goto reread if $! == EINTR;
event_step($self, $!);
+ } elsif (my $as = delete $self->{async}) { # PublicInbox::HTTPD::Async
+ $as->async_pass($self->{psgi_env}->{'psgix.io'},
+ $self->{qx_fh}, \$buf);
+ } elsif ($r) { # generic PSGI:
+ print { $self->{qx_fh} } $buf;
+ } else { # EOF
+ event_step($self, undef);
}
}
^ permalink raw reply related [relevance 7%]
* [PATCH 0/4] qspawn|awaitpid error handling improvements
@ 2023-01-19 20:32 5% Eric Wong
2023-01-19 20:32 7% ` [PATCH 2/4] qspawn: psgi_qx: do not call async_pass on errors Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-01-19 20:32 UTC (permalink / raw)
To: meta
Nothing major, but it makes future work easier and more robust.
Eric Wong (4):
qspawn: {quiet} only affects normal command exit
qspawn: psgi_qx: do not call async_pass on errors
ds: improve error handling of synchronous awaitpid
qspawn: drop unnecessary awaitpid import
lib/PublicInbox/DS.pm | 12 +++++++++---
lib/PublicInbox/Qspawn.pm | 25 ++++++++++++-------------
2 files changed, 21 insertions(+), 16 deletions(-)
^ permalink raw reply [relevance 5%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-01-19 20:32 5% [PATCH 0/4] qspawn|awaitpid error handling improvements Eric Wong
2023-01-19 20:32 7% ` [PATCH 2/4] qspawn: psgi_qx: do not call async_pass on errors Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).