Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Only use one now, instead of 4
Should be cheaper, so more likely to succeed because of larger
maximum value range
  • Loading branch information
lizmat authored and coke committed Dec 25, 2015
1 parent 6b04927 commit 44d8d14
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions S17-supply/throttle.t
Expand Up @@ -16,15 +16,16 @@ diag "**** scheduling with {$*SCHEDULER.WHAT.perl}";
my $before = now;
(1..10).Supply.throttle(1,.5).tap: {
@seen.push($_);
my $diff = now - $before;
$max = $max min now - $before;
$min = $min max now - $before;
$before = now;
my $now = now;
my $diff = $now - $before;
$max = $max min $now - $before;
$min = $min max $now - $before;
$before = $now;
};
sleep 6;
is @seen, (1..10), 'did we see all of the element';
ok $min > .5, 'difference between each at least .5 seconds';
ok $max < .8, 'difference between each at most .8 seconds';
ok $max < .9, 'difference between each at most .8 seconds';
}

{
Expand Down

0 comments on commit 44d8d14

Please sign in to comment.