user/dev discussion of public-inbox itself
 help / Atom feed
* [PATCH] daemon: set $now time for NNTP shutdown
@ 2016-12-12 12:16 Eric Wong
  0 siblings, 0 replies; 1+ messages 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	[flat|threaded] 1+ messages in thread

only message in thread, back to index

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

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.org/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox