diff --git a/services/storage/src/simcore_service_storage/modules/celery/client.py b/services/storage/src/simcore_service_storage/modules/celery/client.py index 23388d71d549..1b491ff197e8 100644 --- a/services/storage/src/simcore_service_storage/modules/celery/client.py +++ b/services/storage/src/simcore_service_storage/modules/celery/client.py @@ -133,15 +133,15 @@ def get_task_status( def _get_completed_task_uuids(self, task_context: TaskContext) -> set[TaskUUID]: search_key = _CELERY_TASK_META_PREFIX + _build_task_id_prefix(task_context) backend_client = self._celery_app.backend.client - if hasattr(backend_client, "keys") and ( - keys := backend_client.keys(f"{search_key}*") - ): - return { - TaskUUID( - f"{key.decode(_CELERY_TASK_ID_KEY_ENCODING).removeprefix(search_key + _CELERY_TASK_ID_KEY_SEPARATOR)}" - ) - for key in keys - } + if hasattr(backend_client, "keys"): + if keys := backend_client.keys(f"{search_key}*"): + return { + TaskUUID( + f"{key.decode(_CELERY_TASK_ID_KEY_ENCODING).removeprefix(search_key + _CELERY_TASK_ID_KEY_SEPARATOR)}" + ) + for key in keys + } + return set() if hasattr(backend_client, "cache"): # NOTE: backend used in testing. It is a dict-like object found_keys = set()