From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) 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.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id DA8E12018C for ; Sat, 18 Jun 2016 21:54:31 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/2] daemon: be less misleading about graceful shutdown Date: Sat, 18 Jun 2016 21:54:30 +0000 Message-Id: <20160618215430.6662-3-e@80x24.org> In-Reply-To: <20160618215430.6662-1-e@80x24.org> References: <20160618215430.6662-1-e@80x24.org> List-Id: We do not need to count the httpd.async object against our running client count, that is tied to the socket of the actual client. This prevents misleading sysadmins about connected clients during shutdown. --- lib/PublicInbox/Daemon.pm | 3 ++- lib/PublicInbox/HTTPD/Async.pm | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm index b76b9ff..a25dd90 100644 --- a/lib/PublicInbox/Daemon.pm +++ b/lib/PublicInbox/Daemon.pm @@ -180,7 +180,8 @@ sub worker_quit { my $n = 0; foreach my $s (values %$dmap) { - if ($s->can('busy') && $s->busy) { + $s->can('busy') or next; + if ($s->busy) { ++$n; } else { # close as much as possible, early as possible diff --git a/lib/PublicInbox/HTTPD/Async.pm b/lib/PublicInbox/HTTPD/Async.pm index fadf2d3..a936d9b 100644 --- a/lib/PublicInbox/HTTPD/Async.pm +++ b/lib/PublicInbox/HTTPD/Async.pm @@ -74,7 +74,4 @@ sub close { PublicInbox::EvCleanup::asap($cleanup) if $cleanup; } -# do not let ourselves be closed during graceful termination -sub busy () { $_[0]->{cb} } - 1;