diff --git a/aiohttp_msal/__init__.py b/aiohttp_msal/__init__.py index c662f6f..da0c315 100644 --- a/aiohttp_msal/__init__.py +++ b/aiohttp_msal/__init__.py @@ -13,7 +13,7 @@ _LOGGER = logging.getLogger(__name__) -VERSION = "0.6.2" +VERSION = "0.6.3" def msal_session(*args: Callable[[AsyncMSAL], Union[Any, Awaitable[Any]]]) -> Callable: diff --git a/aiohttp_msal/redis_tools.py b/aiohttp_msal/redis_tools.py index 8115b67..338608c 100644 --- a/aiohttp_msal/redis_tools.py +++ b/aiohttp_msal/redis_tools.py @@ -33,18 +33,14 @@ async def iter_redis( await redis.delete(key) continue val = json.loads(sval) - ses = val.get("session") + ses = val.get("session") or {} created = val.get("created") if clean and not ses or not created: await redis.delete(key) continue - if match: - for mkey, mval in match.items(): - if mval not in ses[mkey]: - continue - created = val.get("created") or "0" - session = val.get("session") or {} - yield key, created, session + if match and not all(v in ses[k] for k, v in match.items()): + continue + yield key, created or "0", ses async def clean_redis(redis: Redis, max_age: int = 90) -> None: