mirror of
https://github.com/sartography/uva-covid19-testing-communicator.git
synced 2025-02-23 12:28:26 +00:00
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:
parent
1e586df642
commit
43df690e1c
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user