From 8aabaf1f49b8821cef2fc73f7de4ac2713bf908e Mon Sep 17 00:00:00 2001 From: Ben Thorner Date: Tue, 22 Feb 2022 11:32:54 +0000 Subject: [PATCH] Standardise when we clear template cache This is consistent with all other methods: we clear the cache after the actual change, not before it. Since the new version of -utils, we're now catching redis exceptions on delete, so this change has little effect on behaviour. --- app/notify_client/service_api_client.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/notify_client/service_api_client.py b/app/notify_client/service_api_client.py index 87bcf8ac4..ab5f64c88 100644 --- a/app/notify_client/service_api_client.py +++ b/app/notify_client/service_api_client.py @@ -216,8 +216,9 @@ class ServiceAPIClient(NotifyAdminAPIClient): }) data = _attach_current_user(data) endpoint = "/service/{0}/template/{1}".format(service_id, id_) + ret = self.post(endpoint, data) self._delete_template_cache_for_service(service_id) - return self.post(endpoint, data) + return ret @cache.delete('service-{service_id}-templates') def redact_service_template(self, service_id, id_): @@ -311,8 +312,9 @@ class ServiceAPIClient(NotifyAdminAPIClient): 'archived': True } data = _attach_current_user(data) + ret = self.post(endpoint, data=data) self._delete_template_cache_for_service(service_id) - return self.post(endpoint, data=data) + return ret # Temp access of service history data. Includes service and api key history def get_service_history(self, service_id):