]> Sergey Matveev's repositories - public-inbox.git/commitdiff
parentpipe: make the ->close call more obvious
authorEric Wong <e@80x24.org>
Fri, 28 Jun 2019 18:55:09 +0000 (18:55 +0000)
committerEric Wong <e@80x24.org>
Sat, 29 Jun 2019 19:59:00 +0000 (19:59 +0000)
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
lib/PublicInbox/ParentPipe.pm

index cf011a2020b560d544766021435b822d4e32ff21..2b7ac266dfabbccfa83c106c0a114d2f1a446faf 100644 (file)
@@ -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;
index 6ef51c1adbd536527abe71598b899d9783d06220..2e2abb5fd3172303507fc9990d9e707da6a22111 100644 (file)
@@ -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;