-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathDelay.php
More file actions
30 lines (26 loc) · 754 Bytes
/
Delay.php
File metadata and controls
30 lines (26 loc) · 754 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
namespace HubSpot;
class Delay
{
public static function getConstantDelayFunction(int $secondsDelay = 10)
{
return function ($retries) use ($secondsDelay) {
return 1000 * $secondsDelay;
};
}
public static function getLinearDelayFunction()
{
return function ($retries) {
return 1000 * $retries;
};
}
/**
* @deprecated pass null as the delay function instead — Guzzle will apply its built-in exponential delay via \GuzzleHttp\RetryMiddleware::exponentialDelay
*/
public static function getExponentialDelayFunction(int $base)
{
return function ($retries) use ($base) {
return 1000 * pow($base, $retries);
};
}
}