lib/PublicInbox/DS.pm | 9 +++++++-- diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm index e7db2034c868a78a64bbaf18d3f23e25a9f0040b..ed04feb5c9e0d699feb0a4b05252aa29b8faa1aa 100644 --- a/lib/PublicInbox/DS.pm +++ b/lib/PublicInbox/DS.pm @@ -113,8 +113,13 @@ Returns a timer object which you can call C<< $timer->cancel >> on if you need to. =cut sub AddTimer { - my $class = shift; - my ($secs, $coderef) = @_; + my ($class, $secs, $coderef) = @_; + + if (!$secs) { + my $timer = bless([0, $coderef], 'PublicInbox::DS::Timer'); + unshift(@Timers, $timer); + return $timer; + } my $fire_time = now() + $secs;