Callers that want to requeue can call PublicInbox::DS::requeue
directly and not go through the convoluted argument handling
via PublicInbox::HTTPD::Async->new.
---
lib/PublicInbox/HTTPD/Async.pm | 8 --------
lib/PublicInbox/MailDiff.pm | 7 +++----
lib/PublicInbox/SolverGit.pm | 10 +++-------
3 files changed, 6 insertions(+), 19 deletions(-)
diff --git a/lib/PublicInbox/HTTPD/Async.pm b/lib/PublicInbox/HTTPD/Async.pm
index b73d0c4b..2e4d8baa 100644
--- a/lib/PublicInbox/HTTPD/Async.pm
+++ b/lib/PublicInbox/HTTPD/Async.pm
@@ -25,14 +25,6 @@ use PublicInbox::ProcessIONBF;
# bidirectional socket in the future.
sub new {
my ($class, $io, $cb, $arg, $end_obj) = @_;
-
- # no $io? call $cb at the top of the next event loop to
- # avoid recursion:
- unless (defined($io)) {
- PublicInbox::DS::requeue($cb ? $cb : $arg);
- die '$end_obj unsupported w/o $io' if $end_obj;
- return;
- }
my $self = bless {
cb => $cb, # initial read callback
arg => $arg, # arg for $cb
diff --git a/lib/PublicInbox/MailDiff.pm b/lib/PublicInbox/MailDiff.pm
index c3ce9365..908f223c 100644
--- a/lib/PublicInbox/MailDiff.pm
+++ b/lib/PublicInbox/MailDiff.pm
@@ -59,8 +59,7 @@ sub next_smsg ($) {
$ctx->write($ctx->_html_end);
return $ctx->close;
}
- my $async = $self->{ctx}->{env}->{'pi-httpd.async'};
- $async->(undef, undef, $self) if $async # PublicInbox::HTTPD::Async->new
+ PublicInbox::DS::requeue($self) if $ctx->{env}->{'pi-httpd.async'};
}
sub emit_msg_diff {
@@ -125,8 +124,8 @@ sub event_step {
sub begin_mail_diff {
my ($self) = @_;
- if (my $async = $self->{ctx}->{env}->{'pi-httpd.async'}) {
- $async->(undef, undef, $self); # PublicInbox::HTTPD::Async->new
+ if ($self->{ctx}->{env}->{'pi-httpd.async'}) {
+ PublicInbox::DS::requeue($self);
} else {
event_step($self) while $self->{smsg};
}
diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm
index 5f317f51..23d4d3d1 100644
--- a/lib/PublicInbox/SolverGit.pm
+++ b/lib/PublicInbox/SolverGit.pm
@@ -386,12 +386,9 @@ sub event_step ($) {
}
sub next_step ($) {
- my ($self) = @_;
# if outside of public-inbox-httpd, caller is expected to be
# looping event_step, anyways
- my $async = $self->{psgi_env}->{'pi-httpd.async'} or return;
- # PublicInbox::HTTPD::Async->new
- $async->(undef, undef, $self);
+ PublicInbox::DS::requeue($_[0]) if $_[0]->{psgi_env}->{'pi-httpd.async'}
}
sub mark_found ($$$) {
@@ -690,9 +687,8 @@ sub solve ($$$$$) {
$self->{found} = {}; # { abbr => [ ::Git, oid, type, size, $di ] }
dbg($self, "solving $oid_want ...");
- if (my $async = $env->{'pi-httpd.async'}) {
- # PublicInbox::HTTPD::Async->new
- $async->(undef, undef, $self);
+ if ($env->{'pi-httpd.async'}) {
+ PublicInbox::DS::requeue($self);
} else {
event_step($self) while $self->{user_cb};
}