only send a max of 150 emails, increase speed to 2 per second.

(appears that the smtp server starts rejecting requests after 200 emails, so
just playing it safe.
This commit is contained in:
Dan 2020-10-20 15:11:46 -04:00
parent 1e586df642
commit 43df690e1c

View File

@ -75,7 +75,7 @@ def _notify_by_email(file_name=None, retry=False):
.filter(Sample.email_notified == False)
if file_name:
sample_query = sample_query.filter(Sample.ivy_file == file_name)
sample_query = sample_query.limit(150) # Only send out 200 emails at a time.
samples = sample_query.all()
with NotificationService(app) as notifier:
for sample in samples:
@ -90,7 +90,7 @@ def _notify_by_email(file_name=None, retry=False):
db.session.add(Notification(type=EMAIL_TYPE, sample=sample, successful=False,
error_message=str(e)))
db.session.commit()
sleep(2)
sleep(0.5)
def notify_by_text(file_name=None, retry=False):