From ba1766313c85b20d86c7b92e2f62b85eade64f1b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 12 Dec 2016 12:14:02 +0000 Subject: daemon: set $now time for NNTP shutdown commit 6e238ee3396719e578d6a90e177a71ce9f8c1ca0 ("nntp: respect 3 minute idle time for shutdown") was incomplete, and needed this change to Daemon to be effective. In the future, there will be more common code between NNTP.pm and HTTP.pm --- lib/PublicInbox/Daemon.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm index 795ab822..37aa4187 100644 --- a/lib/PublicInbox/Daemon.pm +++ b/lib/PublicInbox/Daemon.pm @@ -9,6 +9,7 @@ use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/; use IO::Handle; use IO::Socket; use Cwd qw/abs_path/; +use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC); STDOUT->autoflush(1); STDERR->autoflush(1); require Danga::Socket; @@ -181,10 +182,11 @@ sub worker_quit { Danga::Socket->SetPostLoopCallback(sub { my ($dmap, undef) = @_; my $n = 0; + my $now = clock_gettime(CLOCK_MONOTONIC); foreach my $s (values %$dmap) { $s->can('busy') or next; - if ($s->busy) { + if ($s->busy($now)) { ++$n; } else { # close as much as possible, early as possible -- cgit v1.2.3-24-ge0c7