From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 0BEED1F61C for ; Mon, 22 Aug 2022 02:33:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1661135627; bh=62pobw+GE+tLGluhW8vmhpilTMVwnjxog9wi+BL0Mqg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=a+0ag/Ondlw18Nbr2OSil1Bf6UjFK4ALBlH5AMkiAXxOA4nI0FdWWnknEITCeQwnZ NxCpM9foPMSeEKLHAh1agdipfIf2Fq+/hzyPlCaRBiF5ikb69dk7Mu0GAMELe1ch9l t/GBg28AjXf/G6AtIxee0NdHXnhZcXGdXru8VCz4= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 4/7] qspawn: add type comments in a few places Date: Mon, 22 Aug 2022 02:33:43 +0000 Message-Id: <20220822023346.938859-5-e@80x24.org> In-Reply-To: <20220822023346.938859-1-e@80x24.org> References: <20220822023346.938859-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This makes things easier-to-follow in a minimally-typed language. --- lib/PublicInbox/LeiBlob.pm | 4 ++-- lib/PublicInbox/Qspawn.pm | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/PublicInbox/LeiBlob.pm b/lib/PublicInbox/LeiBlob.pm index 004b156c..1692289c 100644 --- a/lib/PublicInbox/LeiBlob.pm +++ b/lib/PublicInbox/LeiBlob.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ # "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 diff --git a/lib/PublicInbox/Qspawn.pm b/lib/PublicInbox/Qspawn.pm index 53d0ad55..79db9e76 100644 --- a/lib/PublicInbox/Qspawn.pm +++ b/lib/PublicInbox/Qspawn.pm @@ -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};