user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] daemon: set $now time for NNTP shutdown
@ 2016-12-12 12:16 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2016-12-12 12:16 UTC (permalink / raw)
  To: meta

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(-)

diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index 795ab82..37aa418 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
-- 
EW


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-12-12 12:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-12 12:16 [PATCH] daemon: set $now time for NNTP shutdown Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).