Skip to content

Commit

Permalink
Skip trying to look up users if there are no addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
adammcmaster committed Apr 16, 2018
1 parent 447ac51 commit 8ce1223
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions process.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@

Panoptes.connect(**CONFIG['panoptes'])

for user in User.where(email=addresses_to_unsubscribe, page_size=BATCH_SIZE):
if user.valid_email and user.email in addresses_to_unsubscribe:
print("Invalidating email for {}".format(user.login))
user.reload()
user.valid_email = False
user.save()
if addresses_to_unsubscribe:
for user in User.where(email=addresses_to_unsubscribe, page_size=BATCH_SIZE):
if user.valid_email and user.email in addresses_to_unsubscribe:
print("Invalidating email for {}".format(user.login))
user.reload()
user.valid_email = False
user.save()

for key in processed_s3_keys:
print("Deleting {}".format(key))
Expand Down

0 comments on commit 8ce1223

Please sign in to comment.