Skip to content

Commit 9a270a2

Browse files
authored
fix: retry observation reporting task (#17296)
* fix: retry observation reporting task After seeing the occasional error raised from the upstream service, retry a few times Signed-off-by: Mike Fiedler <[email protected]> * narrow exceptions caught to `requests`-related Signed-off-by: Mike Fiedler <[email protected]> --------- Signed-off-by: Mike Fiedler <[email protected]>
1 parent 16230a1 commit 9a270a2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

warehouse/observations/tasks.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
from base64 import b64encode
1818
from textwrap import dedent
1919

20+
from requests.exceptions import RequestException
21+
2022
from warehouse import db, tasks
2123
from warehouse.helpdesk.interfaces import IHelpDeskService
2224

@@ -51,7 +53,13 @@ def execute_observation_report(config: Configurator, session: SA_Session):
5153
config.task(report_observation_to_helpscout).delay(obj.id)
5254

5355

54-
@tasks.task(bind=True, ignore_result=True, acks_late=True)
56+
@tasks.task(
57+
bind=True,
58+
ignore_result=True,
59+
acks_late=True,
60+
autoretry_for=(RequestException,),
61+
retry_backoff=True,
62+
)
5563
def report_observation_to_helpscout(task, request: Request, model_id: UUID) -> None:
5664
"""
5765
Report an Observation to HelpScout for further tracking.

0 commit comments

Comments
 (0)