@@ -62,12 +62,30 @@ async def run(self):
62
62
63
63
headers = dict (self .m .headers , ** self .recipient .headers )
64
64
65
+ if self .ctx ['job_try' ] >= 2 :
66
+ main_logger .info ('%s: rending email' , self .group_id )
65
67
email_info = await self ._render_email (context , headers )
68
+ if self .ctx ['job_try' ] >= 2 :
69
+ main_logger .info ('%s: finished rending email' , self .group_id )
66
70
if not email_info :
67
71
return
68
72
73
+ if self .ctx ['job_try' ] >= 2 :
74
+ main_logger .info (
75
+ '%s: generating %d PDF attachments and %d other attachments' ,
76
+ self .group_id ,
77
+ len (self .recipient .pdf_attachments ),
78
+ len (self .recipient .attachments ),
79
+ )
69
80
attachments = [a async for a in self ._generate_base64_pdf (self .recipient .pdf_attachments )]
70
81
attachments += [a async for a in self ._generate_base64 (self .recipient .attachments )]
82
+ if self .ctx ['job_try' ] >= 2 :
83
+ main_logger .info (
84
+ '%s: finished generating all attachments' ,
85
+ self .group_id ,
86
+ len (self .recipient .pdf_attachments ),
87
+ len (self .recipient .attachments ),
88
+ )
71
89
72
90
if self .m .method == EmailSendMethod .email_mandrill :
73
91
if self .recipient .address .endswith ('@example.com' ):
@@ -106,7 +124,11 @@ async def _send_mandrill(self, email_info: EmailInfo, attachments: List[dict]):
106
124
job_try = self .ctx ['job_try' ]
107
125
defer = email_retrying [job_try - 1 ]
108
126
try :
127
+ if job_try >= 2 :
128
+ main_logger .info ('%s: sending data to mandrill' , self .group_id )
109
129
r = await self .ctx ['mandrill' ].post ('messages/send.json' , ** data )
130
+ if job_try >= 2 :
131
+ main_logger .info ('%s: finished sending data to mandrill' , self .group_id )
110
132
except (ConnectError , TimeoutError ) as e :
111
133
main_logger .info ('client connection error group_id=%s job_try=%s defer=%ss' , self .group_id , job_try , defer )
112
134
raise Retry (defer = defer ) from e
0 commit comments