mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 10:11:52 +00:00
Add support of None argument in dp.throttled
This commit is contained in:
parent
828f6f2fbf
commit
769be286f7
1 changed files with 13 additions and 12 deletions
|
|
@ -1077,18 +1077,19 @@ class Dispatcher(DataMixin, ContextInstanceMixin):
|
||||||
}
|
}
|
||||||
) # update kwargs with parameters which were given to throttled
|
) # update kwargs with parameters which were given to throttled
|
||||||
|
|
||||||
if asyncio.iscoroutinefunction(on_throttled):
|
if on_throttled:
|
||||||
await on_throttled(*args, **kwargs)
|
if asyncio.iscoroutinefunction(on_throttled):
|
||||||
else:
|
await on_throttled(*args, **kwargs)
|
||||||
kwargs.update(
|
else:
|
||||||
{
|
kwargs.update(
|
||||||
'loop': asyncio.get_running_loop()
|
{
|
||||||
}
|
'loop': asyncio.get_running_loop()
|
||||||
)
|
}
|
||||||
partial_func = functools.partial(on_throttled, *args, **kwargs)
|
)
|
||||||
asyncio.get_running_loop().run_in_executor(None,
|
partial_func = functools.partial(on_throttled, *args, **kwargs)
|
||||||
partial_func
|
asyncio.get_running_loop().run_in_executor(None,
|
||||||
)
|
partial_func
|
||||||
|
)
|
||||||
|
|
||||||
return wrapped
|
return wrapped
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue