Skip to content

Commit

Permalink
increase timespan between each retry
Browse files Browse the repository at this point in the history
Signed-off-by: Bjoern Schiessle <[email protected]>
  • Loading branch information
schiessle committed Feb 20, 2019
1 parent d413498 commit f6b0a65
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class RetryJob extends Job {
private $jobList;
/** @var string */
private $lookupServer;
/** @var int how much time should be between two tries (10 minutes) */
private $interval = 600;
/** @var int how much time should be between two, will be increased for each retry */
private $interval = 100;

/**
* @param IClientService $clientService
Expand Down Expand Up @@ -108,7 +108,9 @@ protected function run($argument) {
* @return bool
*/
protected function shouldRun($argument) {
return !isset($argument['lastRun']) || ((time() - $argument['lastRun']) > $this->interval);
$retryNo = (int)$argument['retryNo'];
$delay = $this->interval * 6 ** $retryNo;
return !isset($argument['lastRun']) || ((time() - $argument['lastRun']) > $delay);
}

/**
Expand Down

0 comments on commit f6b0a65

Please sign in to comment.