diff options
author | Eric Wong <e@80x24.org> | 2016-07-02 21:50:30 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-07-02 21:52:30 +0000 |
commit | 6e238ee3396719e578d6a90e177a71ce9f8c1ca0 (patch) | |
tree | fcec69d8aef33b03a4509ea745b40dc4756a52d0 /lib/PublicInbox/NNTP.pm | |
parent | b830cf90a2d9787315320aa4f4640f97fb1bea87 (diff) | |
download | public-inbox-6e238ee3396719e578d6a90e177a71ce9f8c1ca0.tar.gz |
This avoids breaking clients on graceful shutdown since NNTP responses should usually be quick.
Diffstat (limited to 'lib/PublicInbox/NNTP.pm')
-rw-r--r-- | lib/PublicInbox/NNTP.pm | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index b07e1845..56d08385 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -998,10 +998,19 @@ sub watch_read { $rv; } +sub not_idle_long ($$) { + my ($self, $now) = @_; + defined(my $fd = $self->{fd}) or return; + my $ary = $EXPMAP->{$fd} or return; + my $exp_at = $ary->[0] + $EXPTIME; + $exp_at > $now; +} + # for graceful shutdown in PublicInbox::Daemon: -sub busy () { - my ($self) = @_; - ($self->{rbuf} ne '' || $self->{long_res} || $self->{write_buf_size}); +sub busy { + my ($self, $now) = @_; + ($self->{rbuf} ne '' || $self->{long_res} || $self->{write_buf_size} || + not_idle_long($self, $now)); } 1; |