Stop Redis exception by not passing Redis an empty set to delete

We use `redis_client.delete` to delete multiple keys at once, but this
raises a `redis.exceptions.ResponseError` if it is called with an empty list
or set. We should only call `redis_client.delete` when there is at least
one item to delete.
This commit is contained in:
Katie Smith
2018-12-31 15:04:52 +00:00
parent bbaa51443a
commit ed84e0958a

View File

@@ -38,10 +38,11 @@ class TemplateFolderAPIClient(NotifyAdminAPIClient):
'folders': list(folder_ids),
})
self.redis_client.delete(*map(
'template-{}-version-None'.format,
template_ids,
))
if template_ids:
self.redis_client.delete(*map(
'template-{}-version-None'.format,
template_ids,
))
@cache.delete('service-{service_id}-template-folders')
def update_template_folder(self, service_id, template_folder_id, name):