mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-23 19:20:47 +02:00
Slight sleep to rate-limit email sending
This commit is contained in:
parent
4402dfd90d
commit
b110ac1efa
1 changed files with 4 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
import logging
|
||||
import copy
|
||||
import time
|
||||
|
||||
from django.core.management import BaseCommand
|
||||
from registrar.models import TransitionDomain
|
||||
|
@ -112,6 +113,9 @@ class Command(BaseCommand):
|
|||
if len(self.emails_to_send) > 0:
|
||||
for email_data in self.emails_to_send:
|
||||
self.send_email(email_data)
|
||||
# wait 1/10 second until sending the next email to keep us
|
||||
# safely under a rate of 10 emails per second
|
||||
time.sleep(0.1)
|
||||
else:
|
||||
logger.info("no emails to send")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue