]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Qspawn.pm
www: add configurable limiters
[public-inbox.git] / lib / PublicInbox / Qspawn.pm
index cc9c340da26530993267f8cd00dc30da0d83714f..697c55a1b4d5ec8ad579a03a0b8fdea6e45136a2 100644 (file)
@@ -47,7 +47,7 @@ sub start {
        my ($self, $limiter, $cb) = @_;
        $self->{limiter} = $limiter;
 
-       if ($limiter->{running} < $limiter->{limit}) {
+       if ($limiter->{running} < $limiter->{max}) {
                _do_spawn($self, $cb);
        } else {
                push @{$limiter->{run_queue}}, [ $self, $cb ];
@@ -59,9 +59,10 @@ use strict;
 use warnings;
 
 sub new {
-       my ($class, $limit) = @_;
+       my ($class, $max) = @_;
        bless {
-               limit => $limit || 1,
+               # 32 is same as the git-daemon connection limit
+               max => $max || 32,
                running => 0,
                run_queue => [],
        }, $class;