-
Notifications
You must be signed in to change notification settings - Fork 38
Actually mail the terms notification #972
Comments
Testing with my account and with a test one that is bouncing. I'm looking for the bounce notification to queue up in SNS. |
Well, SQS via SNS. |
The queue is working! I see delivery notifications in it. |
The subquery for recent exchanges is adding significant run time to |
406, as expected. 👍
|
Alright! I sent a final working test to myself. Ready? Nothing ventured, nothing gained! 😓 |
Ready....set....GO! |
Email queue is empty! |
|
Hopefully tomorrow I can download the info from the SQS queue and see how many bounces and complaints we got. |
The spike back in December is interesting. Security researcher? |
Branch file cleared in gratipay/gratipay.com@da2bd9c. |
Downloading raw json with:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import sys
import boto3
sqs = boto3.resource('sqs')
queue = sqs.Queue('https://sqs.us-west-2.amazonaws.com/482083521290/email-status-notifications')
nempty = 0
while nempty < 10:
nprocessed = 0
for message in queue.receive_messages():
try:
msg = json.loads(message.body)
except:
import pdb; pdb.set_trace()
open('email_status_queue/{}.json'.format(msg['MessageId']), 'w+').write(message.body)
message.delete()
sys.stdout.write('.')
sys.stdout.flush()
nprocessed = 1
if nprocessed == 0:
nempty += 1 |
Oh that's right.
|
Got 'em! 👍
|
Committed to a local git repo just to be safe ... |
Polled the queue through the AWS console. It's empty. 👍 Gonna leave that so we can keep collecting bounce messages ahead of gratipay/gratipay.com#4284. |
I've deleted the secret key that I used for this. |
Okay! Signed out of AWS. Now to inspect the files and see how many bounces and complaints we got! |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import collections
import json
import os
counts = collections.defaultdict(int)
for filename in os.listdir('email_status_queue'):
if not filename.endswith('.json'): continue
try:
raw = open('email_status_queue/'+filename).read()
message = json.loads(raw)
message = json.loads(message['Message']) # Aaaah, Jeff Bezos! :)
except Exception as exc:
print(exc)
import pdb; pdb.set_trace()
counts[message['notificationType']] += 1
for nmessages, notification_type in reversed(sorted((v,k) for k,v in counts.items())):
print('{:>3} {}'.format(nmessages, notification_type)) |
Two were me testing, two were legit—we caught two bounces! 💃 |
Now I guess we just manually mark those as unverified, ya? |
I'm working up a SQL script to do the unverifying. We don't have that API in Python or HTTP. I'm snagging an |
Actually, we don't have an event associated specifically with verification (only |
Working with |
Tested locally with: #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
from gratipay import wireup
from gratipay.models.participant import Participant
bad_address = sys.argv[1]
db = wireup.db(wireup.env())
participant = db.one('select p.*::participants from participants p '
'where email_address=%s', (bad_address,))
db.run('update participants set email_address=null where email_address=%s', (bad_address,))
participant = Participant.from_id(participant.id) # refresh self.email_address
participant.remove_email(bad_address) |
Ooh! Even better. :-) #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
from gratipay import wireup
bad_address = sys.argv[1]
db = wireup.db(wireup.env())
participant = db.one('update participants p set email_address=null '
'where email_address=%s returning p.*::participants', (bad_address,))
participant.remove_email(bad_address) |
Okay!
|
|
|
Confirmed in the UI for email and events for both participants. Huzzah! 💃 |
I've thrown away the email status queue. We are done here. |
gratipay/gratipay.com#4232 → gratipay/gratipay.com#4282 → …
The text was updated successfully, but these errors were encountered: