mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Refactor archive to do one sync delete of all keys rather than many
Otherwise we could be waiting on 50 sync calls to redis to happen. This
way we do it in one sync call and follow the pattern of
b98f4561fa/app/notify_client/organisations_api_client.py (L56)
This commit is contained in:
@@ -130,11 +130,9 @@ class ServiceAPIClient(NotifyAdminAPIClient):
|
||||
|
||||
@cache.delete('service-{service_id}')
|
||||
@cache.delete('service-{service_id}-templates')
|
||||
def archive_service(self, service_id, service_users):
|
||||
# We need to purge the cache for the services users as otherwise, although they will have had their permissions
|
||||
# removed in the DB, they would still have permissions in the cache to view/edit/manage this service
|
||||
for user in service_users:
|
||||
cache.delete(f'user-{user.id}')
|
||||
def archive_service(self, service_id, cached_service_user_ids):
|
||||
if cached_service_user_ids:
|
||||
cache.delete(*map('user-{}'.format, cached_service_user_ids))
|
||||
return self.post('/service/{}/archive'.format(service_id), data=None)
|
||||
|
||||
@cache.delete('service-{service_id}')
|
||||
|
||||
Reference in New Issue
Block a user