Skip to content

Commit

Permalink
Fix to bug minutes on add_token_to_redis
Browse files Browse the repository at this point in the history
  • Loading branch information
jonra1993 committed Dec 17, 2022
1 parent 7296120 commit 9f0f62f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fastapi-alembic-sqlmodel-async/app/utils/token.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Optional
from datetime import timedelta
from uuid import UUID
from aioredis import Redis
from app.models.user_model import User
Expand All @@ -16,7 +17,7 @@ async def add_token_to_redis(
valid_tokens = await get_valid_tokens(redis_client, user.id, token_type)
await redis_client.sadd(token_key, token)
if not valid_tokens:
await redis_client.expire(token_key, expire_time)
await redis_client.expire(token_key, timedelta(minutes=expire_time))


async def get_valid_tokens(redis_client: Redis, user_id: UUID, token_type: TokenType):
Expand Down

0 comments on commit 9f0f62f

Please sign in to comment.