$throttle = new Stiphle\Throttle\LeakyBucket;
for ($i = 1; $i <= 100; $i++) {
$throttle->throttle('x', 2, 20000).PHP_EOL;
echo time().PHP_EOL;
}
Gives an output of:
1552774090
1552774090
1552774100
1552774110
1552774120
1552774130
1552774100-1552774090=10, so we're doing more than 2 in a 20 second period ?
Same goes fo the rest, they go up in to second increments 00,10,20,30....
(PHP PHP 7.2.16 on Linux)
Gives an output of:
1552774100-1552774090=10, so we're doing more than 2 in a 20 second period ?
Same goes fo the rest, they go up in to second increments 00,10,20,30....
(PHP PHP 7.2.16 on Linux)