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,6 +38,7 @@ class TemplateFolderAPIClient(NotifyAdminAPIClient):
'folders': list(folder_ids), 'folders': list(folder_ids),
}) })
if template_ids:
self.redis_client.delete(*map( self.redis_client.delete(*map(
'template-{}-version-None'.format, 'template-{}-version-None'.format,
template_ids, template_ids,