sleep for 60s when rate limit is hit for the first time
This commit is contained in:
parent
a8b3955fe6
commit
2524c8ab98
|
@ -1858,8 +1858,21 @@ async def handle(envelope: Envelope) -> str:
|
|||
return status.E523
|
||||
|
||||
if rate_limited(mail_from, rcpt_tos):
|
||||
LOG.w("Rate Limiting applied for mail_from:%s rcpt_tos:%s", mail_from, rcpt_tos)
|
||||
LOG.w(
|
||||
"Rate Limiting applied for mail_from:%s rcpt_tos:%s, retry in 60s",
|
||||
mail_from,
|
||||
rcpt_tos,
|
||||
)
|
||||
# slow down the rate a bit
|
||||
await asyncio.sleep(60)
|
||||
|
||||
# rate limit is still applied
|
||||
if rate_limited(mail_from, rcpt_tos):
|
||||
LOG.w(
|
||||
"Rate Limiting (no retry) applied for mail_from:%s rcpt_tos:%s",
|
||||
mail_from,
|
||||
rcpt_tos,
|
||||
)
|
||||
# add more logging info. TODO: remove
|
||||
if len(rcpt_tos) == 1:
|
||||
alias = Alias.get_by(email=rcpt_tos[0])
|
||||
|
|
Loading…
Reference in New Issue