mirror of
https://github.com/pretix/pretix.git
synced 2026-08-25 13:12:00 +00:00
Increase retry interval of emails
This commit is contained in:
@@ -250,7 +250,7 @@ def send_webhook(self, logentry_id: int, action_type: str, webhook_id: int):
|
|||||||
webhook.enabled = False
|
webhook.enabled = False
|
||||||
webhook.save()
|
webhook.save()
|
||||||
elif resp.status_code > 299:
|
elif resp.status_code > 299:
|
||||||
raise self.retry(countdown=2 ** (self.request.retries * 2))
|
raise self.retry(countdown=2 ** (self.request.retries * 2)) # max is 2 ** (8*2) = 65536 seconds = ~18 hours
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
WebHookCall.objects.create(
|
WebHookCall.objects.create(
|
||||||
webhook=webhook,
|
webhook=webhook,
|
||||||
@@ -262,6 +262,6 @@ def send_webhook(self, logentry_id: int, action_type: str, webhook_id: int):
|
|||||||
payload=json.dumps(payload),
|
payload=json.dumps(payload),
|
||||||
response_body=str(e)[:1024 * 1024]
|
response_body=str(e)[:1024 * 1024]
|
||||||
)
|
)
|
||||||
raise self.retry(countdown=2 ** (self.request.retries * 2))
|
raise self.retry(countdown=2 ** (self.request.retries * 2)) # max is 2 ** (8*2) = 65536 seconds = ~18 hours
|
||||||
except MaxRetriesExceededError:
|
except MaxRetriesExceededError:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ def mail_send_task(self, *args, to: List[str], subject: str, body: str, html: st
|
|||||||
backend.send_messages([email])
|
backend.send_messages([email])
|
||||||
except smtplib.SMTPResponseException as e:
|
except smtplib.SMTPResponseException as e:
|
||||||
if e.smtp_code in (101, 111, 421, 422, 431, 442, 447, 452):
|
if e.smtp_code in (101, 111, 421, 422, 431, 442, 447, 452):
|
||||||
self.retry(max_retries=5, countdown=2 ** (self.request.retries * 2))
|
self.retry(max_retries=5, countdown=2 ** (self.request.retries * 3)) # max is 2 ** (4*3) = 4096 seconds = 68 minutes
|
||||||
logger.exception('Error sending email')
|
logger.exception('Error sending email')
|
||||||
|
|
||||||
if order:
|
if order:
|
||||||
@@ -389,7 +389,7 @@ def mail_send_task(self, *args, to: List[str], subject: str, body: str, html: st
|
|||||||
raise SendMailException('Failed to send an email to {}.'.format(to))
|
raise SendMailException('Failed to send an email to {}.'.format(to))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if isinstance(e, (smtplib.SMTPServerDisconnected, smtplib.SMTPConnectError, ssl.SSLError, OSError)):
|
if isinstance(e, (smtplib.SMTPServerDisconnected, smtplib.SMTPConnectError, ssl.SSLError, OSError)):
|
||||||
self.retry(max_retries=5, countdown=2 ** (self.request.retries * 2))
|
self.retry(max_retries=5, countdown=2 ** (self.request.retries * 3)) # max is 2 ** (4*3) = 4096 seconds = 68 minutes
|
||||||
if order:
|
if order:
|
||||||
order.log_action(
|
order.log_action(
|
||||||
'pretix.event.order.email.error',
|
'pretix.event.order.email.error',
|
||||||
|
|||||||
Reference in New Issue
Block a user