You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Plugin/RetryPlugin.php
+66-29Lines changed: 66 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -31,13 +31,23 @@ final class RetryPlugin implements Plugin
31
31
/**
32
32
* @var callable
33
33
*/
34
-
private$exceptionDelay;
34
+
private$errorResponseDelay;
35
+
36
+
/**
37
+
* @var callable
38
+
*/
39
+
private$errorResponseDecider;
35
40
36
41
/**
37
42
* @var callable
38
43
*/
39
44
private$exceptionDecider;
40
45
46
+
/**
47
+
* @var callable
48
+
*/
49
+
private$exceptionDelay;
50
+
41
51
/**
42
52
* Store the retry counter for each request.
43
53
*
@@ -49,44 +59,41 @@ final class RetryPlugin implements Plugin
49
59
* @param array $config {
50
60
*
51
61
* @var int $retries Number of retries to attempt if an exception occurs before letting the exception bubble up.
62
+
* @var callable $error_response_decider A callback that gets a request and response to decide whether the request should be retried.
52
63
* @var callable $exception_decider A callback that gets a request and an exception to decide after a failure whether the request should be retried.
64
+
* @var callable $error_response_delay A callback that gets a request and response and the number of retries and returns how many microseconds we should wait before trying again.
53
65
* @var callable $exception_delay A callback that gets a request, an exception and the number of retries and returns how many microseconds we should wait before trying again.
54
66
* }
67
+
*
68
+
* @since exception_decider and error_response_decider have been added in version 2. In version 1.*, the exception_decider has been called decider.
55
69
*/
56
70
publicfunction__construct(array$config = [])
57
71
{
58
-
if (array_key_exists('decider', $config)) {
59
-
if (array_key_exists('exception_decider', $config)) {
60
-
thrownew \InvalidArgumentException('Do not set both the old "decider" and new "exception_decider" options');
61
-
}
62
-
trigger_error('The "decider" option has been deprecated in favour of "exception_decider"', E_USER_DEPRECATED);
0 commit comments