]> Sergey Matveev's repositories - public-inbox.git/commitdiff
evcleanup: disable outside of daemon
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>
Fri, 2 Mar 2018 03:12:23 +0000 (03:12 +0000)
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>
Fri, 2 Mar 2018 09:06:08 +0000 (09:06 +0000)
We'll be using these in a more OO manner for V2Writable
(which doesn't use Danga::Socket), so lets not unnecessarily
register cleanup handlers intended for network daemons.

lib/PublicInbox/Daemon.pm
lib/PublicInbox/EvCleanup.pm
lib/PublicInbox/Inbox.pm

index 0329bd34ed3292ea93b7db3a737bded43119bf43..9d27d2be522e908d4cca5b3d2e9c859aecea59b1 100644 (file)
@@ -460,6 +460,7 @@ sub daemon_loop ($$) {
        @listeners = map {
                PublicInbox::Listener->new($_, $post_accept)
        } @listeners;
+       $PublicInbox::EvCleanup::ENABLED = 1;
        Danga::Socket->EventLoop;
        $parent_pipe = undef;
 }
index 559730e980d528d55f065dfbc9338aa630125d57..8ed5180b76953a12b8163447e6045b3d6cf08576 100644 (file)
@@ -7,6 +7,8 @@ use strict;
 use warnings;
 use base qw(Danga::Socket);
 use fields qw(rd);
+
+our $ENABLED;
 my $singleton;
 my $asapq = [ [], undef ];
 my $nextq = [ [], undef ];
index 54a6eb32e184f71b8350454292dc4dbf06534314..b9cd4c40a6dc7541f799f0da8b520e426af7df4d 100644 (file)
@@ -29,6 +29,7 @@ sub cleanup_task () {
 
 sub _cleanup_later ($) {
        my ($self) = @_;
+       return unless $PublicInbox::EvCleanup::ENABLED;
        $cleanup_timer ||= PublicInbox::EvCleanup::later(*cleanup_task);
        $CLEANUP->{"$self"} = $self;
 }