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.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 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 1FB601FA18 for ; Thu, 14 Oct 2021 13:16:10 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 6/7] lei up: actually rely on DESTROY for --alllll Date: Thu, 14 Oct 2021 13:16:08 +0000 Message-Id: <20211014131609.829-7-e@80x24.org> In-Reply-To: <20211014131609.829-1-e@80x24.org> References: <20211014131609.829-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We need to use DESTROY here to ensure we wait for workers, too; not just the initial dispatch. Fixes: cafbd77b3c82167d ("lei up: avoid excessively parallel --all") --- lib/PublicInbox/LeiUp.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/LeiUp.pm b/lib/PublicInbox/LeiUp.pm index 3011300dd836..719736e8597e 100644 --- a/lib/PublicInbox/LeiUp.pm +++ b/lib/PublicInbox/LeiUp.pm @@ -63,6 +63,7 @@ sub redispatch_all ($$) { $op_c->{ops} = { '' => [ $lei->can('dclose'), $lei ] }; my @first_batch = splice(@$upq, 0, $j); # initial parallelism $lei->{-upq} = $upq; + $lei->{daemon_pid} = $$; $lei->event_step_init; # wait for client disconnects for my $out (@first_batch) { PublicInbox::DS::requeue( @@ -158,18 +159,22 @@ sub event_step { # runs via PublicInbox::DS::requeue $l->{opt} = { %{$l->{opt}} }; # deep copy delete $l->{opt}->{all}; $l->qerr("# updating $self->{out}"); - $l->{up_op_p} = $self->{op_p}; # ($l => $lei => script/lei) + my $o = " (output: $self->{out})"; # add to all warnings my $cb = $SIG{__WARN__} // \&CORE::warn; - my $o = " (output: $self->{out})"; local $SIG{__WARN__} = sub { my @m = @_; push(@m, $o) if !@m || $m[-1] !~ s/\n\z/$o\n/; $cb->(@m); }; + $l->{-up1} = $self; eval { $l->dispatch('up', $self->{out}) }; $lei->child_error(0, $@) if $@ || $l->{failed}; # lei->fail() +} - # onto the next: +sub DESTROY { + my ($self) = @_; + my $lei = $self->{lei}; # the original, from lei_up + return if $lei->{daemon_pid} != $$; my $out = shift(@{$lei->{-upq}}) or return; PublicInbox::DS::requeue(nxt($lei, $out, $self->{op_p})); }