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 DC38C1F4BF for ; Sat, 29 Jun 2019 19:59:53 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 09/11] parentpipe: make the ->close call more obvious Date: Sat, 29 Jun 2019 19:59:49 +0000 Message-Id: <20190629195951.32160-10-e@80x24.org> In-Reply-To: <20190629195951.32160-1-e@80x24.org> References: <20190629195951.32160-1-e@80x24.org> List-Id: We can close directly in event_step without bad side effects, and then we also don't need to take a reason arg from worker_quit, since we weren't logging it anywhere. --- lib/PublicInbox/Daemon.pm | 4 +--- lib/PublicInbox/ParentPipe.pm | 5 ++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm index cf011a20..2b7ac266 100644 --- a/lib/PublicInbox/Daemon.pm +++ b/lib/PublicInbox/Daemon.pm @@ -252,13 +252,11 @@ sub daemonize () { sub worker_quit { - my ($reason) = @_; # killing again terminates immediately: exit unless @listeners; $_->close foreach @listeners; # call PublicInbox::DS::close @listeners = (); - $reason->close if ref($reason) eq 'PublicInbox::ParentPipe'; my $proc_name; my $warn = 0; @@ -590,7 +588,7 @@ sub daemon_loop ($$$$) { } else { reopen_logs(); $set_user->() if $set_user; - $SIG{USR2} = sub { worker_quit('USR2') if upgrade() }; + $SIG{USR2} = sub { worker_quit() if upgrade() }; $refresh->(); } $uid = $gid = undef; diff --git a/lib/PublicInbox/ParentPipe.pm b/lib/PublicInbox/ParentPipe.pm index 6ef51c1a..2e2abb5f 100644 --- a/lib/PublicInbox/ParentPipe.pm +++ b/lib/PublicInbox/ParentPipe.pm @@ -19,6 +19,9 @@ sub new ($$$) { } # master process died, time to call worker_quit ourselves -sub event_step { $_[0]->{cb}->($_[0]) } +sub event_step { + $_[0]->close; # PublicInbox::DS::close + $_[0]->{cb}->(); +} 1; -- EW