Skip to content

Commit ce8729c

Browse files
committed
changes
1 parent b2277f0 commit ce8729c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

backend/notifications/tasks.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@
1919
)
2020
@transaction.atomic()
2121
def send_pending_email(self, sent_email_id: int):
22-
email_backend_connection = get_connection()
22+
logger.info(
23+
"Sending sent_email=%s (retry=%s of %s)",
24+
sent_email_id,
25+
self.request.retries,
26+
self.max_retries,
27+
)
2328

2429
sent_email = (
2530
SentEmail.objects.select_for_update(skip_locked=True)
@@ -31,6 +36,8 @@ def send_pending_email(self, sent_email_id: int):
3136
if not sent_email:
3237
return
3338

39+
email_backend_connection = get_connection()
40+
3441
if self.request.retries >= self.max_retries - 1:
3542
sent_email.mark_as_failed()
3643
logger.error(
@@ -39,8 +46,6 @@ def send_pending_email(self, sent_email_id: int):
3946
)
4047
return
4148

42-
logger.info("Sending sent_email=%s", sent_email.id)
43-
4449
message_id = send_email(sent_email, email_backend_connection)
4550
sent_email.mark_as_sent(message_id)
4651

0 commit comments

Comments
 (0)