Skip to content

fix(trashBin): give each trash type its own restart budget DEV-2618 - #7514

Open
rajpatel24 wants to merge 2 commits into
mainfrom
dev-2618-per-type-restart-budgets
Open

fix(trashBin): give each trash type its own restart budget DEV-2618#7514
rajpatel24 wants to merge 2 commits into
mainfrom
dev-2618-per-type-restart-budgets

Conversation

@rajpatel24

Copy link
Copy Markdown
Contributor

📣 Summary

Splits MAX_RESTARTED_TASKS into three per-type settings for trash bin deletions, and stops task_restarter from swallowing its own soft time limit.

📖 Description

Implements the findings from #7422 and supersedes it.

The investigation showed that limiting how many deletions task_restarter enqueues does not limit DB pressure: concurrency is set by the size of the worker pool, not by how many messages are published. Two things from #7422 are worth keeping on their own merits, and this PR is just those two.

  1. Per-type restart budgets. _restart_stuck_tasks() sliced all three trash types with settings.MAX_RESTARTED_TASKS, which project_ownership/tasks.py also uses with a different "batch per run" meaning - one shared name, two unrelated behaviours. Each trash type now has its own setting:
  • MAX_RESTARTED_ACCOUNT_DELETIONS
  • MAX_RESTARTED_PROJECT_DELETIONS
  • MAX_RESTARTED_ATTACHMENT_DELETIONS

All default to 100, so behaviour is unchanged. They are separate because the three deletions do not cost the same.

  1. Do not swallow SoftTimeLimitExceeded. In the enqueue block it was caught by the generic except Exception and logged as Could not restart #, which is wrong on both counts: nothing is wrong with the object, and the restarter had already claimed it, so it sat untouched until the next stuck threshold ~76 minutes later. It now restores date_modified and re-raises.

@greptile-apps

greptile-apps Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR separates trash-bin restart limits into account, project, and attachment settings while retaining the project-ownership limit. It also restores a task’s prior modification timestamp and propagates SoftTimeLimitExceeded when the restarter times out.

  • Adds three environment-configurable restart budgets, each defaulting to 100.
  • Passes the applicable budget into _restart_stuck_tasks.
  • Releases the current timestamp claim before re-raising a soft timeout.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains in the eligible follow-up scope.

No blocking failure remains.

Reviews (2): Last reviewed commit: "style: fix linting issues" | Re-trigger Greptile

@rajpatel24
rajpatel24 requested a review from noliveleger August 31, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant