]> Sergey Matveev's repositories - public-inbox.git/commitdiff
ds: ->Reset initializes $nextq
authorEric Wong <e@80x24.org>
Fri, 29 Nov 2019 10:14:10 +0000 (10:14 +0000)
committerEric Wong <e@80x24.org>
Wed, 11 Dec 2019 08:10:28 +0000 (08:10 +0000)
I haven't noticed this being a problem in practice, but
be consistent with the rest of the singleton stuff.
Since we always call Reset() at load time, only do
initialization in that sub and not at declaration.

lib/PublicInbox/DS.pm

index 17c640f4c1aac251460e09309dd320fb1bffd1fa..301ec0570e5afad3831a4ca283a8ab26fbaec116 100644 (file)
@@ -39,8 +39,8 @@ use Errno  qw(EAGAIN EINVAL);
 use Carp   qw(croak confess carp);
 require File::Spec;
 
-my $nextq = []; # queue for next_tick
-my $WaitPids = [];               # list of [ pid, callback, callback_arg ]
+my $nextq; # queue for next_tick
+my $WaitPids; # list of [ pid, callback, callback_arg ]
 my $reap_timer;
 our (
      %DescriptorMap,             # fd (num) -> PublicInbox::DS object
@@ -69,6 +69,7 @@ Reset all state
 =cut
 sub Reset {
     %DescriptorMap = ();
+    $nextq = [];
     $WaitPids = [];
     $reap_timer = undef;
     @ToClose = ();