Skip to content

Commit

Permalink
修改重试功能
Browse files Browse the repository at this point in the history
  • Loading branch information
pgyf committed Oct 11, 2022
1 parent 4b99a55 commit ab70a69
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/HttpClient/RetryableClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ trait RetryableClient
protected $maxRetries = 1;

/**
* Undocumented function
* @param array|bool $config
* @return self
*/
Expand Down Expand Up @@ -56,6 +55,20 @@ public function retry($config = []): self
}


/**
* @param RetryStrategyInterface $strategy
* @return self
*/
public function retrySetStrategy(RetryStrategyInterface $strategy, int $maxRetries = 1): self
{
if(empty($strategy)){
return $this;
}
return $this->retryUsing($strategy, $maxRetries);
}



public function retryUsing(
RetryStrategyInterface $strategy,
int $maxRetries = 1,
Expand Down

0 comments on commit ab70a69

Please sign in to comment.