diff options
author | Eric Wong <e@80x24.org> | 2016-04-30 02:57:40 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-04-30 08:29:33 +0000 |
commit | 9da6fcbb3e6d720a4b575a48063ecf3240a44022 (patch) | |
tree | 2f633838fd3e5595c2cbb57dfd421713f2a5533c /lib/PublicInbox/ParentPipe.pm | |
parent | f30a78b3b8f00298c5be2aa724a7358ff892efda (diff) | |
download | public-inbox-9da6fcbb3e6d720a4b575a48063ecf3240a44022.tar.gz |
git clones may take longer than 30s, much longer... So prepare to wait almost indefinitely for sockets to timeout and document the second signal behavior for immediate shutdown. While we're at it, move parent death handling to a separate class to avoid Danga::Socket->AddOtherFds, since that does not allow proper handling the parent pipe being closed and would actually misterminate a worker prematurely. t/nntpd.t is update to illustrate the failure with workers enabled. We will work to keep memory usage low and let clients take their time without interrupting them.
Diffstat (limited to 'lib/PublicInbox/ParentPipe.pm')
-rw-r--r-- | lib/PublicInbox/ParentPipe.pm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/PublicInbox/ParentPipe.pm b/lib/PublicInbox/ParentPipe.pm new file mode 100644 index 00000000..d2d054ce --- /dev/null +++ b/lib/PublicInbox/ParentPipe.pm @@ -0,0 +1,21 @@ +# Copyright (C) 2016 all contributors <meta@public-inbox.org> +# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt> +# only for PublicInbox::Daemon +package PublicInbox::ParentPipe; +use strict; +use warnings; +use base qw(Danga::Socket); +use fields qw(cb); + +sub new ($$$) { + my ($class, $pipe, $cb) = @_; + my $self = fields::new($class); + $self->SUPER::new($pipe); + $self->{cb} = $cb; + $self->watch_read(1); + $self; +} + +sub event_read { $_[0]->{cb}->($_[0]) } + +1; |