try timezones

This commit is contained in:
2022-11-23 17:09:35 +03:00
parent a41af344a7
commit 94a31e29e5
16 changed files with 41 additions and 43 deletions

View File

@@ -9,7 +9,7 @@ from settings import SESSION_TOKEN_LIFE_SPAN, ONETIME_TOKEN_LIFE_SPAN
async def save(token_key, life_span, auto_delete=True):
await redis.execute("SET", token_key, "True")
if auto_delete:
expire_at = (datetime.now() + timedelta(seconds=life_span)).timestamp()
expire_at = (datetime.now(tz=timezone.utc) + timedelta(seconds=life_span)).timestamp()
await redis.execute("EXPIREAT", token_key, int(expire_at))