diff options
Diffstat (limited to 'apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php')
-rw-r--r-- | apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php b/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php index cf0691de3ac..f785f4fc528 100644 --- a/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php +++ b/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php @@ -41,19 +41,14 @@ use OCP\ILogger; * @package OCA\FederatedFileSharing\BackgroundJob */ class RetryJob extends Job { - - /** @var bool */ - private $retainJob = true; - - /** @var Notifications */ - private $notifications; + private bool $retainJob = true; + private Notifications $notifications; /** @var int max number of attempts to send the request */ - private $maxTry = 20; + private int $maxTry = 20; /** @var int how much time should be between two tries (10 minutes) */ - private $interval = 600; - + private int $interval = 600; public function __construct(Notifications $notifications, ITimeFactory $time) { @@ -62,14 +57,11 @@ class RetryJob extends Job { } /** - * run the job, then remove it from the jobList - * - * @param IJobList $jobList - * @param ILogger|null $logger + * Run the job, then remove it from the jobList */ - public function execute(IJobList $jobList, ILogger $logger = null) { + public function start(IJobList $jobList): void { if ($this->shouldRun($this->argument)) { - parent::execute($jobList, $logger); + parent::start($jobList); $jobList->remove($this, $this->argument); if ($this->retainJob) { $this->reAddJob($jobList, $this->argument); @@ -93,12 +85,9 @@ class RetryJob extends Job { } /** - * re-add background job with new arguments - * - * @param IJobList $jobList - * @param array $argument + * Re-add background job with new arguments */ - protected function reAddJob(IJobList $jobList, array $argument) { + protected function reAddJob(IJobList $jobList, array $argument): void { $jobList->add(RetryJob::class, [ 'remote' => $argument['remote'], @@ -113,12 +102,9 @@ class RetryJob extends Job { } /** - * test if it is time for the next run - * - * @param array $argument - * @return bool + * Test if it is time for the next run */ - protected function shouldRun(array $argument) { + protected function shouldRun(array $argument): bool { $lastRun = (int)$argument['lastRun']; return (($this->time->getTime() - $lastRun) > $this->interval); } |