🚨 auto fix by pre-commit hooks
Some checks failed
TypeCheck / TypeCheck (push) Has been cancelled

This commit is contained in:
pre-commit-ci[bot]
2025-02-10 22:54:51 +00:00
parent 05d8a22a24
commit 9a924a42a8
3 changed files with 7 additions and 5 deletions

View File

@@ -23,7 +23,9 @@ def limit(limit: timedelta) -> Callable[[Callable[P, Coroutine[Any, Any, T]]], C
nonlocal last_call nonlocal last_call
async with lock: async with lock:
if (diff := (time() - last_call)) < limit_seconds: if (diff := (time() - last_call)) < limit_seconds:
logger.debug(f'func: {func.__name__} trigger limit, wait {(limit_time:=limit_seconds-diff):.3f}s') logger.debug(
f'func: {func.__name__} trigger limit, wait {(limit_time := limit_seconds - diff):.3f}s'
)
await sleep(limit_time) await sleep(limit_time)
last_call = time() last_call = time()
return await func(*args, **kwargs) return await func(*args, **kwargs)