Skip to content

fix(jobs-worker): delay next check by one second - #64178

Open
ArtificialOwl wants to merge 2 commits into
masterfrom
fix/noid/wait-a-second
Open

fix(jobs-worker): delay next check by one second#64178
ArtificialOwl wants to merge 2 commits into
masterfrom
fix/noid/wait-a-second

Conversation

@ArtificialOwl

@ArtificialOwl ArtificialOwl commented Sep 10, 2026

Copy link
Copy Markdown
Member

When running ./occ background-job:worker we need to add a slightly delay to the next check of a job returned by IJobList::getNext()

Currently the same job - with small value in setInterval() - is returned multiple time until interval fit,
resulting in a loop of 10-20 identical select+update for a full second:
image

This patch will avoid that loop:
image


The edit in TimedJob is to avoid a job to be initiated (returned as ready from the database) but not started before the next second (and reinitiated)

@ArtificialOwl
ArtificialOwl requested a review from a team as a code owner September 10, 2026 11:24
@ArtificialOwl
ArtificialOwl requested review from come-nc, icewind1991, leftybournes and provokateurin and removed request for a team September 10, 2026 11:24
@ArtificialOwl ArtificialOwl added this to the Nextcloud 36 milestone Sep 10, 2026
@ArtificialOwl

Copy link
Copy Markdown
Member Author

/backport to stable35

@ArtificialOwl

Copy link
Copy Markdown
Member Author

/backport to stable34

@ArtificialOwl

Copy link
Copy Markdown
Member Author

/backport to stable33

Comment thread lib/private/BackgroundJob/JobList.php
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants