about summary refs log tree commit homepage
path: root/t/qspawn.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-07-09 03:18:34 +0000
committerEric Wong <e@80x24.org>2016-07-09 03:20:24 +0000
commitf89bd1444a595b569606679293d2d01b0b7a049e (patch)
treefbb8007c319f0655adbc1245dfff48bd441c720f /t/qspawn.t
parent239514fd687eb88d023b67de1daccaf2e440e884 (diff)
downloadpublic-inbox-f89bd1444a595b569606679293d2d01b0b7a049e.tar.gz
And bump the default limit to 32 so we match git-daemon
behavior.  This shall allow us to configure different levels
of concurrency for different repositories and prevent clones
of giant repos from stalling service to small repos.
Diffstat (limited to 't/qspawn.t')
-rw-r--r--t/qspawn.t10
1 files changed, 6 insertions, 4 deletions
diff --git a/t/qspawn.t b/t/qspawn.t
index 05072e24..9c42e100 100644
--- a/t/qspawn.t
+++ b/t/qspawn.t
@@ -2,10 +2,12 @@
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use Test::More;
 use_ok 'PublicInbox::Qspawn';
+
+my $limiter = PublicInbox::Qspawn::Limiter->new(1);
 {
         my $x = PublicInbox::Qspawn->new([qw(true)]);
         my $run = 0;
-        $x->start(sub {
+        $x->start($limiter, sub {
                 my ($rpipe) = @_;
                 is(0, sysread($rpipe, my $buf, 1), 'read zero bytes');
                 ok(!$x->finish, 'no error on finish');
@@ -17,7 +19,7 @@ use_ok 'PublicInbox::Qspawn';
 {
         my $x = PublicInbox::Qspawn->new([qw(false)]);
         my $run = 0;
-        $x->start(sub {
+        $x->start($limiter, sub {
                 my ($rpipe) = @_;
                 is(0, sysread($rpipe, my $buf, 1), 'read zero bytes from false');
                 my $err = $x->finish;
@@ -30,7 +32,7 @@ use_ok 'PublicInbox::Qspawn';
 foreach my $cmd ([qw(sleep 1)], [qw(sh -c), 'sleep 1; false']) {
         my $s = PublicInbox::Qspawn->new($cmd);
         my @run;
-        $s->start(sub {
+        $s->start($limiter, sub {
                 my ($rpipe) = @_;
                 push @run, 'sleep';
                 is(0, sysread($rpipe, my $buf, 1), 'read zero bytes');
@@ -39,7 +41,7 @@ foreach my $cmd ([qw(sleep 1)], [qw(sh -c), 'sleep 1; false']) {
         my @t = map {
                 my $i = $n++;
                 my $x = PublicInbox::Qspawn->new([qw(true)]);
-                $x->start(sub {
+                $x->start($limiter, sub {
                         my ($rpipe) = @_;
                         push @run, $i;
                 });