Skip to content

[15.0] [IMP] Automatically requeue dead jobs - #796

Closed
feketemihai wants to merge 6 commits into
OCA:15.0from
NextERP-Romania:15.0-remove_dead_jobs
Closed

[15.0] [IMP] Automatically requeue dead jobs#796
feketemihai wants to merge 6 commits into
OCA:15.0from
NextERP-Romania:15.0-remove_dead_jobs

Conversation

@feketemihai

Copy link
Copy Markdown
Member

Backport of #716 .

sbidouland others added 4 commits June 17, 2025 09:54
A model is better than a manually managed table as it will
protect the table from deletion by database_cleanup.
…eue jobs in timeout
[IMP] queue_job: increment 'retry' when re-queuing job that have been killed
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @guewen,
some modules you are maintaining are being modified, check this out!

@FrancoMaximeFrancoMaxime left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM: code review

@AnizRAnizR left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

Comment on lines +299 to +305
def set_job_pending(self, uuid):
with closing(self.conn.cursor()) as cr:
cr.execute(
"UPDATE queue_job SET state=%s, " "date_enqueued=NULL " "WHERE uuid=%s",
(PENDING, uuid),
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that I can be removed

CASE
WHEN
max_retries IS NOT NULL AND
retry IS NOT NULL AND

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would cherry pick: #816 that fixes the case of having max_retries = 0

Comment on lines +490 to +501
# In case we have enqueued jobs we move them to pending,
# otherwise they remain enqueued and occupy channels slots.
if job_data[6] == "enqueued":
try:
self.db_by_name[db_name].set_job_pending(job_data[1])
job_data = (*job_data[:6], "pending")
except Exception:
_logger.warning(
"error setting job %s to pending",
job_data[1],
exc_info=True,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why do you do this?
I don't think that it is needed

@sbidoulsbidoul added this to the 15.0 milestone Jan 2, 2026
@github-actions

Copy link
Copy Markdown

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actionsgithub-actionsBot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label May 3, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stalePR/Issue without recent activity, it'll be soon closed automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@feketemihai@OCA-git-bot@sbidoul@FrancoMaxime@AnizR