1 # Copyright (C) 2016-2019 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 # event cleanups (for PublicInbox::DS)
5 package PublicInbox::EvCleanup;
8 require PublicInbox::DS;
10 # this only runs under public-inbox-{httpd/nntpd}, not generic PSGI servers
12 sub enabled { $ENABLED }
13 sub enable { $ENABLED = 1 }
14 my $laterq = [ [], undef ];
17 my $run = $laterq->[0];
25 push @{$laterq->[0]}, $cb;
26 $laterq->[1] ||= PublicInbox::DS->AddTimer(60, *_run_later);