Skip to content

fix(jobs): don't overwrite the --stop_after baseline in background-job:worker - #63297

Open
vaenda wants to merge 1 commit into
nextcloud:masterfrom
vaenda:patch-1
Open

fix(jobs): don't overwrite the --stop_after baseline in background-job:worker#63297
vaenda wants to merge 1 commit into
nextcloud:masterfrom
vaenda:patch-1

Conversation

@vaenda

@vaenda vaenda commented Aug 15, 2026

Copy link
Copy Markdown

Resolves: #63296

Summary

$startTime was used for two different things:
as baseline for --stop_after and as start time of the currently running job. The variable was reassigned during each loop with each new job in the queue, so the baseline for --stop_after was lost and the worker never terminated.

Renaming the job variable fixes this issue. I applied the patch to my instance and measured it before and after: unpatched the worker was still running after 120s with -t 20s, patched it exits after 20.97s, and after 45.83s with -t 45s.

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Tests (unit, integration, api and/or acceptance) are included
    — there is no tests/Core/Command/Background/ directory, these commands
    are not covered by unit tests. Happy to add one if you want the timing
    loop covered.
  • Screenshots before/after for front-end changes — n/a, no front-end change
  • Documentation has been updated or is not required — not required
  • Backports requested where applicable — 34 is affected; leaving the label
    to the maintainers
  • Labels added where applicable — maintainers
  • Milestone added for target branch/version — maintainers

AI usage

  • The content of this PR was partly or fully generated using AI

I had Claude Code work through a large background job backlog on my own Nextcloud instance, and it ran into --stop_after not stopping the worker. It located the cause in the code and suggested the rename. I applied the patch to my instance and measured it before and after: unpatched the worker was still running after 120s with -t 20s, patched it exits after 20.97s, and after 45.83s with -t 45s. The commit carries an Assisted-by: Claude:claude-opus-5 trailer.

…b:worker

$startTime was used for two different things:
as baseline for --stop_after and as start time of the currently running job. 
The variable was reassigned during each loop with each new job in the queue, so the baseline for --stop_after was lost and the worker never terminated.

Renaming the job variable fixes this issue.

Assisted-by: Claude:claude-opus-5

Signed-off-by: Sven Hansen <vaenda@vaenda.de>
@vaenda
vaenda requested a review from a team as a code owner August 15, 2026 21:19
@vaenda
vaenda requested review from Altahrim, CarlSchwan, come-nc and leftybournes and removed request for a team August 15, 2026 21:19
@solracsf

Copy link
Copy Markdown
Member

/backport to stable34

@solracsf solracsf added this to the Nextcloud 35 milestone Aug 15, 2026
@solracsf solracsf added bug 3. to review Waiting for reviews AI assisted community pull requests from community labels Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews AI assisted backport-request bug community pull requests from community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

background-job:worker ignores --stop_after, worker never exits

2 participants