From 7535ed6c4697511a9d5f25629bf1669567114746 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= <jan.bednarik@gmail.com>
Date: Wed, 10 Jan 2024 20:10:51 +0100
Subject: [PATCH] Limit emails task retry

---
 helios_auth/auth_systems/pirati.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/helios_auth/auth_systems/pirati.py b/helios_auth/auth_systems/pirati.py
index 595f73a..80fc39c 100644
--- a/helios_auth/auth_systems/pirati.py
+++ b/helios_auth/auth_systems/pirati.py
@@ -168,7 +168,12 @@ def old_member_to_user_info(member):
 # Celery tasks
 
 
-@shared_task(autoretry_for=(Exception,), max_retries=None, retry_backoff=True)
+@shared_task(
+    autoretry_for=(Exception,),
+    max_retries=160,  # 3 days
+    retry_backoff=True,
+    retry_backoff_max=1800,
+)
 def send_email_task(recipient, subject, body):
     send_mail(subject, body, settings.SERVER_EMAIL, [recipient], fail_silently=False)
 
-- 
GitLab