Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/public/BackgroundJob/TimedJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* @since 15.0.0
*/
abstract class TimedJob extends Job {
protected static int $lastRunCheckMargin = 20;
protected int $interval = 0;
protected int $timeSensitivity = IJob::TIME_SENSITIVE;

Expand Down Expand Up @@ -81,7 +82,7 @@ final public function execute(IJobList $jobList, ?ILogger $logger = null) {
* @since 25.0.0
*/
final public function start(IJobList $jobList): void {
if (($this->time->getTime() - $this->lastRun) > $this->interval) {
if (($this->time->getTime() - $this->lastRun) > $this->interval - self::$lastRunCheckMargin) {
if ($this->interval >= 12 * 60 * 60 && $this->isTimeSensitive()) {
Server::get(LoggerInterface::class)->debug('TimedJob ' . get_class($this) . ' has a configured interval of ' . $this->interval . ' seconds, but is also marked as time sensitive. Please consider marking it as time insensitive to allow more sensitive jobs to run when needed.');
}
Expand Down