Skip to content

Commit

Permalink
redistools
Browse files Browse the repository at this point in the history
  • Loading branch information
kellerza committed Oct 5, 2023
1 parent d807c05 commit 75ec3c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion aiohttp_msal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 4 additions & 8 deletions aiohttp_msal/redis_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 75ec3c5

Please sign in to comment.