Skip to content

fix(taskworker): keep a task's deadline when a database error replaces it at the end of a transaction - #132063

Draft
ldelvoye wants to merge 1 commit into
ldelvoye/feat/deadline-restore-switchfrom
ldelvoye/fix/deadline-restore-rule
Draft

ldelvoye wants to merge 1 commit into
ldelvoye/feat/deadline-restore-switchfrom
ldelvoye/fix/deadline-restore-rule

Conversation

@ldelvoye

Copy link
Copy Markdown
Member

INFRENG-1035, part 2 of 3

Stops a database error from hiding a task's deadline when the deadline lands while a transaction block is ending, so a task that catches errors on each row stops instead of running on with no time limit. It only acts with the switch from the PR below at enforce, and the switch ships off.

The layers of code around the end of a transaction block, before and after: a deadline lands during Django's commit and cleanup raises a database error with the deadline behind it; today the task's loop catches that error and keeps writing rows; after, a new layer directly around Django's block end catches the database error first and raises the deadline instead, so the task stops.

The rule is installed at start-up and only acts inside a task.

…ock exit

A deadline that lands while a transaction block ends is replaced by the
error Django's cleanup raises next, so a task catching errors per row
never stops. In enforce mode the wrapper raises the deadline instead.
It only changes which error is raised, and the mode ships off.
@ldelvoye
ldelvoye added this pull request to stack #132065 November 20, 2026 21:07
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant