Skip to content

Commit ad3e02b

Browse files
provokateurinbackportbot[bot]
authored andcommitted
feat(TimedJob): Add debug log about time sensitive jobs with long intervals
Signed-off-by: provokateurin <[email protected]> [skip ci]
1 parent 8225324 commit ad3e02b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/public/BackgroundJob/TimedJob.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
namespace OCP\BackgroundJob;
2828

2929
use OCP\ILogger;
30+
use OCP\Server;
31+
use Psr\Log\LoggerInterface;
3032

3133
/**
3234
* Simple base class to extend to run periodic background jobs.
@@ -99,6 +101,9 @@ final public function execute(IJobList $jobList, ILogger $logger = null) {
99101
*/
100102
final public function start(IJobList $jobList): void {
101103
if (($this->time->getTime() - $this->lastRun) > $this->interval) {
104+
if ($this->interval >= 12 * 60 * 60 && $this->isTimeSensitive()) {
105+
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.');
106+
}
102107
parent::start($jobList);
103108
}
104109
}

0 commit comments

Comments
 (0)