Fixes and added tests for the security notification worker

Fixes #1301

- Ensures that the worker uses pagination properly
- Ensures that the worker handles failure as expected
- Moves marking the notification as read to after the worker processes it
- Increases the number of layers requested to 100
This commit is contained in:
Joseph Schorr 2016-03-18 20:28:06 -04:00
parent e8a511d526
commit aa5587c93c
4 changed files with 75 additions and 15 deletions

View file

@ -19,14 +19,5 @@ def secscan_notification():
abort(400)
notification = data['Notification']
# Queue the notification to be processed.
item_id = secscan_notification_queue.put(['named', notification['Name']],
json.dumps(notification))
# Mark the notification as read.
if not secscan_api.mark_notification_read(notification['Name']):
secscan_notification_queue.cancel(item_id)
abort(400)
secscan_notification_queue.put(['named', notification['Name']], json.dumps(notification))
return make_response('Okay')