diff options
Diffstat (limited to 'lib/public/BackgroundJob/TimedJob.php')
-rw-r--r-- | lib/public/BackgroundJob/TimedJob.php | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/public/BackgroundJob/TimedJob.php b/lib/public/BackgroundJob/TimedJob.php index 579486f6fbf..9d6b599c21b 100644 --- a/lib/public/BackgroundJob/TimedJob.php +++ b/lib/public/BackgroundJob/TimedJob.php @@ -36,13 +36,11 @@ use OCP\ILogger; * @since 15.0.0 */ abstract class TimedJob extends Job { - /** @var int */ - protected $interval = 0; - /** @var int */ - protected $timeSensitivity = IJob::TIME_SENSITIVE; + protected int $interval = 0; + protected int $timeSensitivity = IJob::TIME_SENSITIVE; /** - * set the interval for the job + * Set the interval for the job * * @param int $seconds the time to pass between two runs of the same job in seconds * @@ -89,10 +87,20 @@ abstract class TimedJob extends Job { * @param ILogger|null $logger * * @since 15.0.0 + * @deprecated since 25.0.0 Use start() instead */ final public function execute($jobList, ILogger $logger = null) { + $this->start($jobList); + } + + /** + * Run the job if the last run is is more than the interval ago + * + * @since 25.0.0 + */ + final public function start(IJobList $jobList): void { if (($this->time->getTime() - $this->lastRun) > $this->interval) { - parent::execute($jobList, $logger); + parent::start($jobList); } } } |