Slight sleep to rate-limit email sending

This commit is contained in:
Neil Martinsen-Burrell 2023-11-13 16:33:32 -06:00
parent 4402dfd90d
commit b110ac1efa
No known key found for this signature in database
GPG key ID: 6A3C818CC10D0184

View file

@ -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")