-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConstantBackOff.php
More file actions
30 lines (25 loc) · 860 Bytes
/
ConstantBackOff.php
File metadata and controls
30 lines (25 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
declare(strict_types=1);
namespace Orangesoft\BackOff;
use Orangesoft\BackOff\Duration\Duration;
use Orangesoft\BackOff\Generator\Generator;
use Orangesoft\BackOff\Jitter\JitterInterface;
use Orangesoft\BackOff\Jitter\NullJitter;
use Orangesoft\BackOff\Sleeper\Sleeper;
use Orangesoft\BackOff\Sleeper\SleeperInterface;
use Orangesoft\BackOff\Strategy\ConstantStrategy;
final class ConstantBackOff extends BackOff
{
public function __construct(
Duration $baseTime,
Duration $capTime,
?JitterInterface $jitter = null,
?SleeperInterface $sleeper = null,
) {
$strategy = new ConstantStrategy();
$jitter ??= new NullJitter();
$generator = new Generator($strategy, $jitter);
$sleeper ??= new Sleeper();
parent::__construct($baseTime, $capTime, $generator, $sleeper);
}
}