]> Sergey Matveev's repositories - public-inbox.git/commitdiff
qspawn: add type comments in a few places
authorEric Wong <e@80x24.org>
Mon, 22 Aug 2022 02:33:43 +0000 (02:33 +0000)
committerEric Wong <e@80x24.org>
Tue, 23 Aug 2022 04:19:00 +0000 (04:19 +0000)
This makes things easier-to-follow in a minimally-typed language.

lib/PublicInbox/LeiBlob.pm
lib/PublicInbox/Qspawn.pm

index 004b156c3396acde3e419bbe723e7cd144ebcf4d..1692289c5e27ac932fe54b1bda90ea2be04c38b2 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # "lei blob $OID" command
@@ -70,7 +70,7 @@ sub do_solve_blob { # via wq_do
                        } @$git_dirs ],
                user_cb => \&solver_user_cb,
                uarg => $self,
-               # -cur_di, -qsp, -msg => temporary fields for Qspawn callbacks
+               # -cur_di, -msg => temporary fields for Qspawn callbacks
                inboxes => [ $self->{lxs}->locals, @rmt ],
        }, 'PublicInbox::SolverGit';
        local $PublicInbox::DS::in_loop = 0; # waitpid synchronously
index 53d0ad55ee84d47ccc10bd2d7516136fd38207e8..79db9e7618fc183ca2d9a35ddfbcdda7ebc2a9d9 100644 (file)
@@ -132,7 +132,7 @@ sub start ($$$) {
 
 sub psgi_qx_init_cb {
        my ($self) = @_;
-       my $async = delete $self->{async};
+       my $async = delete $self->{async}; # PublicInbox::HTTPD::Async
        my ($r, $buf);
        my $qx_fh = $self->{qx_fh};
 reread:
@@ -227,11 +227,10 @@ sub psgi_return_init_cb {
                PublicInbox::GzipFilter::qsp_maybe($r->[1], $env);
 
        my $wcb = delete $env->{'qspawn.wcb'};
-       my $async = delete $self->{async};
+       my $async = delete $self->{async}; # PublicInbox::HTTPD::Async
        if (scalar(@$r) == 3) { # error
-               if ($async) {
-                       # calls rpipe->close && ->event_step
-                       $async->close;
+               if ($async) { # calls rpipe->close && ->event_step
+                       $async->close; # PublicInbox::HTTPD::Async::close
                } else {
                        $self->{rpipe}->close;
                        event_step($self);
@@ -255,9 +254,9 @@ sub psgi_return_init_cb {
 
 sub psgi_return_start { # may run later, much later...
        my ($self) = @_;
-       if (my $async = $self->{psgi_env}->{'pi-httpd.async'}) {
+       if (my $cb = $self->{psgi_env}->{'pi-httpd.async'}) {
                # PublicInbox::HTTPD::Async->new(rpipe, $cb, $cb_arg, $end_obj)
-               $self->{async} = $async->($self->{rpipe},
+               $self->{async} = $cb->($self->{rpipe},
                                        \&psgi_return_init_cb, $self, $self);
        } else { # generic PSGI
                psgi_return_init_cb($self) while $self->{parse_hdr};