From 57798dc0f70c407799fe6933bd9d42f6083cc3db Mon Sep 17 00:00:00 2001 From: Untone Date: Fri, 27 Sep 2024 12:04:32 +0300 Subject: [PATCH] logging-conf-fix2 --- state/redis.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/state/redis.py b/state/redis.py index 90234e6..364fc2d 100644 --- a/state/redis.py +++ b/state/redis.py @@ -69,11 +69,12 @@ class RedisService: async def scan_iter(self, pattern="*"): """Asynchronously iterate over keys matching the given pattern.""" - cursor = "0" - while cursor != 0: - cursor, keys = await self._client.scan(cursor=cursor, match=pattern) - for key in keys: - yield key + if self._client: + cursor = "0" + while cursor != 0: + cursor, keys = await self._client.scan(cursor=cursor, match=pattern) + for key in keys: + yield key async def get(self, key): return await self.execute("get", key)