about summary refs log tree commit homepage
path: root/lib/PublicInbox/Daemon.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-16 01:00:54 +0000
committerEric Wong <e@80x24.org>2021-10-16 01:42:49 +0000
commita1a8cbab22adec879f97dccd9acfd0c5b2492ba9 (patch)
tree78647cecb223c4116634fee548de9c075ef574f3 /lib/PublicInbox/Daemon.pm
parentf64adbd5e3c35197c1915bca108cdcd81f74f708 (diff)
downloadpublic-inbox-a1a8cbab22adec879f97dccd9acfd0c5b2492ba9.tar.gz
It's needlessly complex and O(n), so it doesn't scale well to a
high number of clients nor is it easy-to-scale with the data
structures available to us in pure Perl.

In any case, I see no evidence of either -imapd nor -nntpd
experiencing high connection loads on public-facing sites.
-httpd has never had its own timer-based expiration, either.

Fwiw, public-inbox.org itself has been running a public-facing
HTTP/HTTPS server with no userspace idle client expiration for
the past 8 years or with no ill effect.  Clients can come and go
as they wish, and SO_KEEPALIVE takes care of truly broken
connections if they're gone for ~2 hours.

Internet connections drop all time, so it should be harmless to
drop connections w/o warning since both NNTP and IMAP protocols
have well-defined semantics for determining if a message was
truncated (as does HTTP/1.1+).
Diffstat (limited to 'lib/PublicInbox/Daemon.pm')
-rw-r--r--lib/PublicInbox/Daemon.pm8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index 90b77412..50523586 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -271,13 +271,11 @@ sub worker_quit { # $_[0] = signal name or number (unused)
                 my ($dmap, undef) = @_;
                 my $n = 0;
                 my $now = now();
-
-                foreach my $s (values %$dmap) {
+                for my $s (values %$dmap) {
                         $s->can('busy') or next;
-                        if ($s->busy($now)) {
+                        if ($s->busy) {
                                 ++$n;
-                        } else {
-                                # close as much as possible, early as possible
+                        } else { # close as much as possible, early as possible
                                 $s->close;
                         }
                 }