diff options
author | provokateurin <kate@provokateurin.de> | 2024-10-07 17:37:38 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-10-08 11:26:53 +0200 |
commit | b209508d8f4fea31adc6f27871fa6ec69e8770d5 (patch) | |
tree | f842b17f3df3a693645f1c14362095f7dd444dea /lib | |
parent | 54ec472d9a2c8a3d3c5daf0594bb887b11a81614 (diff) | |
download | nextcloud-server-b209508d8f4fea31adc6f27871fa6ec69e8770d5.tar.gz nextcloud-server-b209508d8f4fea31adc6f27871fa6ec69e8770d5.zip |
feat(TimedJob): Add debug log about time sensitive jobs with long intervalsfix/backgroundjobs/adjust-intervals-time-sensitivities
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/public/BackgroundJob/TimedJob.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/public/BackgroundJob/TimedJob.php b/lib/public/BackgroundJob/TimedJob.php index 6a81e841460..85ca34665b4 100644 --- a/lib/public/BackgroundJob/TimedJob.php +++ b/lib/public/BackgroundJob/TimedJob.php @@ -8,6 +8,8 @@ declare(strict_types=1); namespace OCP\BackgroundJob; use OCP\ILogger; +use OCP\Server; +use Psr\Log\LoggerInterface; /** * Simple base class to extend to run periodic background jobs. @@ -80,6 +82,9 @@ abstract class TimedJob extends Job { */ final public function start(IJobList $jobList): void { if (($this->time->getTime() - $this->lastRun) > $this->interval) { + 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.'); + } parent::start($jobList); } } |