Document that the time_sensitive column has to be reset once
Build package / php-lint (8.2) (push) Successful in 50s
Build package / php-lint (8.3) (push) Successful in 36s
Build package / php-lint (8.4) (push) Successful in 40s
Build package / xml-lint (push) Successful in 11s
Build package / unit-tests (push) Successful in 44s
Build package / package (push) Successful in 50s
Build package / php-lint (8.2) (push) Successful in 50s
Build package / php-lint (8.3) (push) Successful in 36s
Build package / php-lint (8.4) (push) Successful in 40s
Build package / xml-lint (push) Successful in 11s
Build package / unit-tests (push) Successful in 44s
Build package / package (push) Successful in 50s
Shipping the TIME_SENSITIVE change is not enough for instances that already ran the job: getNext() filters on the time_sensitive column of oc_jobs, and JobList::setLastRun() only ever sets it to TIME_INSENSITIVE -- there is no else branch, and JobList::add() writes the column only when inserting, so re-registering an existing job on app update or app:enable leaves the stamp in place. Document the one-off UPDATE (and the occ-only alternative) in the README troubleshooting section and in CLAUDE.md.
This commit is contained in:
@@ -24,6 +24,23 @@ The filter-matching logic (`WorkflowRunner::cardMatchesFilters()`, `::isOverdue(
|
||||
|
||||
**The job must stay `IJob::TIME_SENSITIVE`.** It was `TIME_INSENSITIVE` at first, which looked harmless and was not: `OC\Core\Service\CronService::runCli()` reads `maintenance_window_start` (default `100`, i.e. unset) and, whenever the current UTC hour is outside `[start, start+4]`, calls `jobList->getNext($onlyTimeSensitive = true)` — time-insensitive jobs are then skipped for the other 20 hours of the day. On an instance with a maintenance window configured (Nextcloud's admin overview nags admins into setting one) the job simply never ran, showing `last_run = 1970-01-01` in `occ background-job:list` indefinitely. Note this gate only exists in `runCli()`, so it doesn't apply to ajax/webcron mode, and passing job classes explicitly (`occ background-job:worker '<class>'`) bypasses it — which is exactly why manual testing can look fine while cron does nothing.
|
||||
|
||||
**Changing the sensitivity in code does not fix an already-registered job.** `getNext()` filters on the `time_sensitive` *column* of `oc_jobs`, and `JobList::setLastRun()` is a one-way ratchet:
|
||||
|
||||
```php
|
||||
if ($job instanceof TimedJob && !$job->isTimeSensitive()) {
|
||||
$query->set('time_sensitive', $query->createNamedParameter(IJob::TIME_INSENSITIVE));
|
||||
}
|
||||
```
|
||||
|
||||
There is no `else`. Once a job has run while declaring itself insensitive, the row is stamped `TIME_INSENSITIVE` for good — and nothing resets it: `JobList::add()` only writes the column in its *insert* branch, and re-registering an existing job (app update, `app:enable`) takes the *update* branch, which leaves it alone. So after deploying the `TIME_SENSITIVE` change, an existing instance still needs its row fixed once:
|
||||
|
||||
```sql
|
||||
UPDATE oc_jobs SET time_sensitive = 0
|
||||
WHERE class = 'OCA\\WorkflowDeckAutomation\\BackgroundJob\\RunWorkflowsJob';
|
||||
```
|
||||
|
||||
or, without DB access, `occ background-job:delete <id>` followed by `occ app:disable workflow_deck_automation && occ app:enable workflow_deck_automation` to get a freshly inserted row. Fresh installs are unaffected.
|
||||
|
||||
To debug this job on a server: `occ background-job:list --class '<class>'` for its id and last run, then `occ background-job:execute <id> --force-execute` to run it right now regardless of the interval. `occ background-job:worker` takes **job classes**, not an app id.
|
||||
|
||||
## Registration is declarative, not Bootstrap-based
|
||||
|
||||
Reference in New Issue
Block a user