mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Some cache fix
This commit is contained in:
parent
472718c595
commit
b180429505
@ -38,7 +38,7 @@ def cache(ttl: timedelta, cache: Optional[Cache] = None, typed=False):
|
||||
if (
|
||||
ret[2] is not None
|
||||
and ret[1] is not None
|
||||
and ret[1] - datetime.now() < ttl
|
||||
and datetime.now() - ret[1] < ttl
|
||||
):
|
||||
return ret[2]
|
||||
|
||||
@ -58,8 +58,8 @@ async def exec_as_cache(cache: Cache, key, f):
|
||||
event.set()
|
||||
raise
|
||||
|
||||
event.set()
|
||||
cache[key] = (None, datetime.now(), result)
|
||||
event.set()
|
||||
return result
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user