Skip to content

Commit fabf2ca

Browse files
authored
fix(tasks): Make the retry decorator play nicer with retry_task (#94580)
`@retry` exists to simplify configuring error retry behavior; it shouldn't interfere with explicit retry exceptions. Here we avoid reporting exceptions wrapped in Celery's Retry to be consistent with the SDK.
1 parent 97bb17a commit fabf2ca

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/sentry/tasks/base.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99

1010
import sentry_sdk
1111
from celery import Task
12+
from celery.exceptions import Ignore, MaxRetriesExceededError, Reject, Retry
1213
from django.conf import settings
1314
from django.db.models import Model
1415

1516
from sentry import options
1617
from sentry.celery import app
1718
from sentry.silo.base import SiloLimit, SiloMode
1819
from sentry.taskworker.config import TaskworkerConfig
19-
from sentry.taskworker.retry import retry_task
20+
from sentry.taskworker.retry import RetryError, retry_task
2021
from sentry.taskworker.task import Task as TaskworkerTask
2122
from sentry.utils import metrics
2223
from sentry.utils.memory import track_memory_usage
@@ -244,6 +245,10 @@ def inner(func):
244245
def wrapped(*args, **kwargs):
245246
try:
246247
return func(*args, **kwargs)
248+
except (RetryError, Retry, Ignore, Reject, MaxRetriesExceededError):
249+
# We shouldn't interfere with exceptions that exist to communicate
250+
# retry state.
251+
raise
247252
except ignore:
248253
return
249254
except ignore_and_capture:

0 commit comments

Comments
 (0)