Skip to content

Commit

Permalink
fix: Retry message not show on first retry and would show when it wou…
Browse files Browse the repository at this point in the history
…ldn't retry
  • Loading branch information
mathiasgrimm committed Jan 20, 2025
1 parent e68d926 commit d3667ce
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Aws/AwsStorageProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,23 @@ protected function retryHandler()
$stack = HandlerStack::create();

$stack->push(Middleware::retry(function (int $retries, RequestInterface $request, ResponseInterface $response = null) {
$text = '<comment>Retrying Request: </comment><options=bold>'.$request->getMethod().'</> '.Str::before($request->getUri(), '?');

if ($retries === 0) {
Helpers::step($text);
return true;
}

if ($response && $response->getStatusCode() < 300) {
return false;
}

Helpers::step('<comment>Retrying Request: </comment><options=bold>'.$request->getMethod().'</> '.Str::before($request->getUri(), '?'));
if ($retries < self::MAX_RETRIES) {
Helpers::step($text);
return true;
}

return $retries < self::MAX_RETRIES;
return false;
}));

return $stack;
Expand Down

0 comments on commit d3667ce

Please sign in to comment.