Skip to content

Commit 2cf047d

Browse files
AUT-512: Fix method signature in retry logic
Co-authored-by: Bence Kadar <bence.kadar@emarsys.com>
1 parent e594d15 commit 2cf047d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Suite/Api/Middleware/Retry.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Suite\Api\Middleware;
44

55
use GuzzleHttp\Exception\ConnectException;
6-
use GuzzleHttp\Exception\RequestException;
6+
use GuzzleHttp\Exception\TransferException;
77
use GuzzleHttp\Psr7\Request;
88
use GuzzleHttp\Psr7\Response;
99
use Psr\Log\LoggerInterface;
@@ -27,7 +27,7 @@ public function __construct(LoggerInterface $logger, int $maxRetryCount = 1)
2727

2828
public function createHandler()
2929
{
30-
return function (int $retries, Request $request, Response $response = null, RequestException $exception = null) {
30+
return function (int $retries, Request $request, Response $response = null, TransferException $exception = null) {
3131
if ($this->stillHasRetryAttempts($retries) && $this->isRetriableError($response, $exception)) {
3232
$this->log($retries, $request, $response, $exception);
3333
return true;
@@ -51,12 +51,12 @@ private function isServerError(Response $response = null)
5151
return $response && $response->getStatusCode() >= 500;
5252
}
5353

54-
private function isConnectError(RequestException $exception = null)
54+
private function isConnectError(TransferException $exception = null)
5555
{
5656
return $exception instanceof ConnectException;
5757
}
5858

59-
private function log(int $retries, Request $request, Response $response = null, RequestException $exception = null)
59+
private function log(int $retries, Request $request, Response $response = null, TransferException $exception = null)
6060
{
6161
$this->logger->warning(
6262
'Retrying API call',

0 commit comments

Comments
 (0)