aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorprovokateurin <kate@provokateurin.de>2024-10-07 17:37:38 +0200
committerprovokateurin <kate@provokateurin.de>2024-11-25 08:42:06 +0100
commit9388c96a31644f1347c682bc2e3e06a63fa202c2 (patch)
tree2b8d2a25d6c15129ba20e829f1bff84b15c9abaf
parent8225324c946f5a7a4d60a0b10cab10e6fbce9fd8 (diff)
downloadnextcloud-server-9388c96a31644f1347c682bc2e3e06a63fa202c2.tar.gz
nextcloud-server-9388c96a31644f1347c682bc2e3e06a63fa202c2.zip
feat(TimedJob): Add debug log about time sensitive jobs with long intervals
Signed-off-by: provokateurin <kate@provokateurin.de>
-rw-r--r--lib/public/BackgroundJob/TimedJob.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/public/BackgroundJob/TimedJob.php b/lib/public/BackgroundJob/TimedJob.php
index 8fd8fadce4f..3c8931a265e 100644
--- a/lib/public/BackgroundJob/TimedJob.php
+++ b/lib/public/BackgroundJob/TimedJob.php
@@ -27,6 +27,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.
@@ -99,6 +101,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);
}
}