Commit the db session before sending notification to the queue.

When a high volume service posts a notification we want to commit the db session before we send the message to SQS. This will release the db connection earlier.
This commit is contained in:
Rebecca Law
2020-06-19 13:12:05 +01:00
parent 69043d70ec
commit abf36ecd82
2 changed files with 24 additions and 13 deletions

View File

@@ -1006,11 +1006,14 @@ def test_post_notifications_saves_email_normally_if_save_email_to_queue_fails(cl
"template_id": template.id,
"personalisation": {"message": "Dear citizen, have a nice day"}
}
print("******** Start")
response = client.post(
path='/v2/notifications/email',
data=json.dumps(data),
headers=[('Content-Type', 'application/json'), create_authorization_header(service_id=service.id)]
)
print("********** End")
json_resp = response.get_json()