mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-10 17:53:17 +00:00
Rewrite contextvar usage. Implemented ContextInstanceMixin and DataMixin
This commit is contained in:
parent
8ef279bba1
commit
39c333251f
12 changed files with 82 additions and 120 deletions
|
|
@ -56,7 +56,7 @@ class ThrottlingMiddleware(BaseMiddleware):
|
|||
handler = current_handler.get()
|
||||
|
||||
# Get dispatcher from context
|
||||
dispatcher = Dispatcher.current()
|
||||
dispatcher = Dispatcher.get_current()
|
||||
# If handler was configured, get rate limit and key from handler
|
||||
if handler:
|
||||
limit = getattr(handler, 'throttling_rate_limit', self.rate_limit)
|
||||
|
|
@ -83,7 +83,7 @@ class ThrottlingMiddleware(BaseMiddleware):
|
|||
:param throttled:
|
||||
"""
|
||||
handler = current_handler.get()
|
||||
dispatcher = Dispatcher.current()
|
||||
dispatcher = Dispatcher.get_current()
|
||||
if handler:
|
||||
key = getattr(handler, 'throttling_key', f"{self.prefix}_{handler.__name__}")
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue