diff options
author | Eric Wong <e@80x24.org> | 2019-06-24 02:52:04 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-06-24 05:26:25 +0000 |
commit | 860c7e13d31390dc16c2cce813e4887f12e76731 (patch) | |
tree | b24f266351b82ac70a180a71cb04fa43e84639f3 /lib/PublicInbox/Daemon.pm | |
parent | 8c619bae62a3d468505716d58d3559278883eee7 (diff) | |
download | public-inbox-860c7e13d31390dc16c2cce813e4887f12e76731.tar.gz |
All of our internal timing code should use monotonic clocks for consistency against system clock adjustments. This can be shared by our Daemon and NNTP packages.
Diffstat (limited to 'lib/PublicInbox/Daemon.pm')
-rw-r--r-- | lib/PublicInbox/Daemon.pm | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm index 227ba5f9..b8d6b572 100644 --- a/lib/PublicInbox/Daemon.pm +++ b/lib/PublicInbox/Daemon.pm @@ -9,10 +9,9 @@ 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 PublicInbox::DS; +use PublicInbox::DS qw(now); require PublicInbox::EvCleanup; require POSIX; require PublicInbox::Listener; @@ -183,7 +182,7 @@ sub worker_quit { PublicInbox::DS->SetPostLoopCallback(sub { my ($dmap, undef) = @_; my $n = 0; - my $now = clock_gettime(CLOCK_MONOTONIC); + my $now = now(); foreach my $s (values %$dmap) { $s->can('busy') or next; @@ -195,9 +194,9 @@ sub worker_quit { } } if ($n) { - if (($warn + 5) < time) { + if (($warn + 5) < now()) { warn "$$ quitting, $n client(s) left\n"; - $warn = time; + $warn = now(); } unless (defined $proc_name) { $proc_name = (split(/\s+/, $0))[0]; |