Skip to content

Conversation

@armenzg
Copy link
Member

@armenzg armenzg commented Nov 19, 2025

This task attempts to flip the column once every 3 hours, thus, it could be more than 24 hours before we re-attempt a deletion.

Changing this to 6 hours it would ensure that the deletion is re-attempted within 24 hours and re-attempted more often.

This task attempts to flip the column once every 3 hours, thus, it could be more than 24 hours before we re-attempt a deletion.

Changing this to 6 hours it would ensure that the deletion is re-attempted within 24 hours and re-attempted more often.
@armenzg armenzg requested a review from markstory November 19, 2025 15:14
@armenzg armenzg self-assigned this Nov 19, 2025
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 19, 2025
@armenzg armenzg enabled auto-merge (squash) November 19, 2025 15:17
# up in the next deletion run allowing us to start over.
queryset = model_class.objects.filter(
in_progress=True, date_scheduled__lte=timezone.now() - timedelta(days=1)
in_progress=True, date_scheduled__lte=timezone.now() - timedelta(hours=6)
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug: Long-running deletions may be incorrectly reset

Reducing the timeout from 24 hours to 6 hours may cause legitimate long-running deletions to be incorrectly identified as stuck. Large deletions that process in many chunks could take more than 6 hours to complete while remaining in_progress=True. When _reattempt_deletions resets these active deletions, they may be picked up again by _run_scheduled_deletions, potentially causing concurrent deletion attempts on the same object or forcing restarts of in-progress work.

Fix in Cursor Fix in Web

Copy link
Member Author

Choose a reason for hiding this comment

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

Deletion tasks need to finish within 20 minutes:

deletion_tasks = app.taskregistry.create_namespace(
"deletions",
processing_deadline_duration=60 * 20,
app_feature="shared",
)

@instrumented_task(
name="sentry.deletions.tasks.run_scheduled_deletions",
namespace=deletion_tasks,
)
def run_scheduled_deletions() -> None:
_run_scheduled_deletions(
model_class=RegionScheduledDeletion,
process_task=run_deletion,
)

@armenzg armenzg merged commit 1c91bc3 into master Nov 19, 2025
67 checks passed
@armenzg armenzg deleted the armenzg-patch-1 branch November 19, 2025 19:56
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.

3 participants