aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2025-02-21 10:45:40 +0100
committerJoas Schilling <coding@schilljs.com>2025-02-21 10:45:40 +0100
commit72e3e13ac4ecae6d9d81015e19f231adf3475a49 (patch)
treed8489a61b25a06dec1a89c7a8f1029a8c74f78e2
parent33a12eb3af62ccdc748404757aaa2fe973faefed (diff)
downloadnextcloud-server-bugfix/noid/ignore-sensitivity-when-explicitly-scheduled.tar.gz
nextcloud-server-bugfix/noid/ignore-sensitivity-when-explicitly-scheduled.zip
fix(cron): Ignore time sensitivity when a class was explicitely scheduledbugfix/noid/ignore-sensitivity-when-explicitly-scheduled
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--cron.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/cron.php b/cron.php
index ebc0ca358a7..993faae3cae 100644
--- a/cron.php
+++ b/cron.php
@@ -32,6 +32,7 @@ Usage:
Arguments:
job-classes Optional job class list to only run those jobs
+ Providing a class will ignore the time-sensitivity restriction
Options:
-h, --help Display this help message
@@ -112,10 +113,14 @@ Options:
$appConfig->setValueString('core', 'backgroundjobs_mode', 'cron');
}
+ // a specific job class list can optionally be given as argument
+ $jobClasses = array_slice($argv, $verbose ? 2 : 1);
+ $jobClasses = empty($jobClasses) ? null : $jobClasses;
+
// Low-load hours
$onlyTimeSensitive = false;
$startHour = $config->getSystemValueInt('maintenance_window_start', 100);
- if ($startHour <= 23) {
+ if ($jobClasses === null && $startHour <= 23) {
$date = new \DateTime('now', new \DateTimeZone('UTC'));
$currentHour = (int)$date->format('G');
$endHour = $startHour + 4;
@@ -143,9 +148,6 @@ Options:
$endTime = time() + 14 * 60;
$executedJobs = [];
- // a specific job class list can optionally be given as argument
- $jobClasses = array_slice($argv, $verbose ? 2 : 1);
- $jobClasses = empty($jobClasses) ? null : $jobClasses;
while ($job = $jobList->getNext($onlyTimeSensitive, $jobClasses)) {
if (isset($executedJobs[$job->getId()])) {
@@ -159,7 +161,7 @@ Options:
$timeBefore = time();
$memoryBefore = memory_get_usage();
$memoryPeakBefore = memory_get_peak_usage();
-
+
if ($verbose) {
echo 'Starting job ' . $jobDetails . PHP_EOL;
}