Skip to content

fix(tasks): Make the retry decorator play nicer with retry_task #94580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/sentry/tasks/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@

import sentry_sdk
from celery import Task
from celery.exceptions import Ignore, MaxRetriesExceededError, Reject, Retry
from django.conf import settings
from django.db.models import Model

from sentry import options
from sentry.celery import app
from sentry.silo.base import SiloLimit, SiloMode
from sentry.taskworker.config import TaskworkerConfig
from sentry.taskworker.retry import retry_task
from sentry.taskworker.retry import RetryError, retry_task
from sentry.taskworker.task import Task as TaskworkerTask
from sentry.utils import metrics
from sentry.utils.memory import track_memory_usage
Expand Down Expand Up @@ -244,6 +245,10 @@ def inner(func):
def wrapped(*args, **kwargs):
try:
return func(*args, **kwargs)
except (RetryError, Retry, Ignore, Reject, MaxRetriesExceededError):
# We shouldn't interfere with exceptions that exist to communicate
# retry state.
raise
except ignore:
return
except ignore_and_capture:
Expand Down
Loading