Remove update_organisation_name model method

It’s weird to have a method just for updating one attribute. I think
the reason for doing this was to only invalidate the
`organisation-{}-name` cache when absolutely necessary, but:
- we don’t need a separate method to check whether it’s the name being
  updated
- it was easy to get around this by calling
  `OrganisationsClient.update_organisation` directly, leaving a stale
  value in the cache
This commit is contained in:
Chris Hill-Scott
2022-01-11 14:56:58 +00:00
parent c630faf3b4
commit a09af2acc8
2 changed files with 24 additions and 8 deletions

View File

@@ -56,11 +56,10 @@ class OrganisationsClient(NotifyAdminAPIClient):
if cached_service_ids:
redis_client.delete(*map('service-{}'.format, cached_service_ids))
return api_response
if 'name' in kwargs:
redis_client.delete(f'organisation-{org_id}-name')
@cache.delete('organisation-{org_id}-name')
def update_organisation_name(self, org_id, name):
return self.update_organisation(org_id, name=name)
return api_response
@cache.delete('service-{service_id}')
@cache.delete('live-service-and-organisation-counts')