Skip to content

Commit

Permalink
allow customize number of reties and backoff policy for runJob
Browse files Browse the repository at this point in the history
  • Loading branch information
zajca committed Dec 18, 2024
1 parent 22a52bd commit f9eaebb
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ public function runQuery(JobConfigurationInterface $query, array $options = []):
*/
public function runJob(JobConfigurationInterface $config, array $options = []): Job
{
$retryPolicy = new SimpleRetryPolicy(5);
$backOffPolicy = new ExponentialRandomBackOffPolicy(10, 1.8, 300);
$proxy = new RetryProxy($retryPolicy, $backOffPolicy);
$options += [
'retryCount' => 5,
'backOffPolicy' => new ExponentialRandomBackOffPolicy(10, 1.8, 300),
];
$retryPolicy = new SimpleRetryPolicy($options['retryCount']);
$proxy = new RetryProxy($retryPolicy, $options['backOffPolicy']);
$job = $proxy->call(function () use ($config, $options): Job {
return $this->startJob($config, $options);
});
Expand Down

0 comments on commit f9eaebb

Please sign in to comment.