]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
qspawn: drop redundant check against limiter->{max}
authorEric Wong <e@80x24.org>
Sat, 8 Feb 2025 03:26:38 +0000 (03:26 +0000)
committerEric Wong <e@80x24.org>
Tue, 11 Feb 2025 00:11:42 +0000 (00:11 +0000)
We only need to guard against excessive parallelism on entry
in one place during Qspawn->start.  Redundant guards are
confusing and make bugs harder-to-spot.

lib/PublicInbox/Qspawn.pm

index 9bd225b78378d6a71e0a329780d96a0cf9b54c8b..34e9eff69c7862c8041a62a02d7dc4572041f5e9 100644 (file)
@@ -107,13 +107,9 @@ sub finalize ($) {
 
        # process is done, spawn whatever's in the queue
        my $limiter = delete $self->{limiter} or return;
-       my $running = --$limiter->{running};
-
-       if ($running < $limiter->{max}) {
-               if (my $next = shift(@{$limiter->{run_queue}})) {
-                       _do_spawn(@$next, $limiter);
-               }
-       }
+       --$limiter->{running};
+       my $next = shift @{$limiter->{run_queue}};
+       _do_spawn(@$next, $limiter) if $next;
        _finalize $self;
 }