Make the background job time-sensitive so cron actually runs it
Build package / php-lint (8.2) (push) Successful in 48s
Build package / php-lint (8.3) (push) Successful in 45s
Build package / php-lint (8.4) (push) Successful in 47s
Build package / xml-lint (push) Successful in 13s
Build package / unit-tests (push) Successful in 43s
Build package / package (push) Canceled after 0s

The job was registered but never executed: `background-job:list` kept
showing last_run = 1970-01-01. It was marked TIME_INSENSITIVE, and
OC\Core\Service\CronService::runCli() reads `maintenance_window_start` and
calls jobList->getNext($onlyTimeSensitive = true) whenever the current UTC
hour is outside [start, start+4] -- so with a maintenance window configured,
time-insensitive jobs are skipped for the other 20 hours of the day.

A job whose entire purpose is a 5-minute (now configurable down to 60s)
reaction time is time-sensitive by definition.

Also fix the occ invocation in README.md and CLAUDE.md: background-job:worker
takes job classes, not an app id, so the documented
`background-job:worker workflow_deck_automation` matched nothing.
This commit is contained in:
Patrick Niebeling
2026-08-13 14:48:13 +02:00
parent 13903f8137
commit b37a0db123
3 changed files with 21 additions and 3 deletions
+8 -1
View File
@@ -35,7 +35,14 @@ class RunWorkflowsJob extends TimedJob {
// changed config.php takes effect on the next pass — no occ command
// and no re-registration of the job needed.
$this->setInterval(self::resolveInterval($config));
$this->setTimeSensitivity(IJob::TIME_INSENSITIVE);
// Must stay TIME_SENSITIVE. If `maintenance_window_start` is set in
// config.php — and Nextcloud's admin overview actively nags admins
// to set it — CronService only picks up TIME_INSENSITIVE jobs during
// those 4 hours and skips them for the rest of the day. A job whose
// whole point is a 5-minute (configurable down to 60s) reaction time
// would then run a handful of times per night and look completely
// dead in between.
$this->setTimeSensitivity(IJob::TIME_SENSITIVE);
$this->setAllowParallelRuns(false);
}