about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-12-12 12:14:02 +0000
committerEric Wong <e@80x24.org>2016-12-12 12:14:02 +0000
commitba1766313c85b20d86c7b92e2f62b85eade64f1b (patch)
tree622332a1fac65cdbc65aa81b47459f71ecab4664 /lib
parent46174e0f8c151dfb5a42723c865b4893f66e73b0 (diff)
downloadpublic-inbox-ba1766313c85b20d86c7b92e2f62b85eade64f1b.tar.gz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/Daemon.pm4
1 files changed, 3 insertions, 1 deletions
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