Skip to content

Commit

Permalink
fix: Retry task only if it's an Arq task (#1640)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matvey-Kuk authored Aug 20, 2024
1 parent ddba734 commit 95a2bed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion keep/api/tasks/process_event_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,9 @@ def process_event(
)
except Exception:
logger.exception("Error processing event", extra=extra_dict)
raise Retry(defer=ctx["job_try"] * TIMES_TO_RETRY_JOB)
# Retrying only if context is present (running the job in arq worker)
if bool(ctx):
raise Retry(defer=ctx["job_try"] * TIMES_TO_RETRY_JOB)
finally:
session.close()
logger.info("Event processed", extra=extra_dict)
Expand Down

0 comments on commit 95a2bed

Please sign in to comment.