Use cache for tasks that save notifications

These tasks need to repeatedly get the same template and service from
the database. We should be able to improve their performance by getting
the template and service from the cache instead, like we do in the REST
endpoint code.
This commit is contained in:
Chris Hill-Scott
2020-09-26 15:11:38 +01:00
parent 9c01d8018d
commit 4eb4ea1772
4 changed files with 148 additions and 17 deletions

View File

@@ -233,7 +233,7 @@ def test_should_cache_template_lookups_in_memory(mocker, client, sample_template
assert mock_get_template.call_count == 1
assert mock_get_template.call_args_list == [
call(service_id=str(sample_template.service_id), template_id=str(sample_template.id))
call(service_id=str(sample_template.service_id), template_id=str(sample_template.id), version=None)
]
assert Notification.query.count() == 5