Skip to content

Dispatcher.release_key raises KeyError #907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AlexDev505 opened this issue May 12, 2022 · 0 comments · Fixed by #908
Closed

Dispatcher.release_key raises KeyError #907

AlexDev505 opened this issue May 12, 2022 · 0 comments · Fixed by #908
Labels
2.x Issue or PR for legacy 2.x version bug Something is wrong with the framework confirmed This issue is confirmed and requires action

Comments

@AlexDev505
Copy link

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Operating System: Win10
  • Python Version: 3.10
  • aiogram version: 2.20
  • aiohttp version: 3.8.1
  • uvloop version (if installed):

Expected Behavior

Wanted to delete the key

Current Behavior

KeyError: 'key'

Failure Information (for bugs)

  File "app\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 415, in _process_polling_updates
    for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)):
  File "app\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 235, in process_updates
    return await asyncio.gather(*tasks)
  File "app\lib\site-packages\aiogram\dispatcher\handler.py", line 116, in notify
    response = await handler_obj.handler(*args, **partial_data)
  File "app\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 256, in process_update
    return await self.message_handlers.notify(update.message)
  File "app\lib\site-packages\aiogram\dispatcher\handler.py", line 114, in notify
    await self.dispatcher.middleware.trigger(f"process_{self.middleware_key}", args + (data,))
  File "app\lib\site-packages\aiogram\dispatcher\middlewares.py", line 53, in trigger
    await app.trigger(action, args)
  File "app\lib\site-packages\aiogram\dispatcher\middlewares.py", line 106, in trigger
    await handler(*args)
  File "app\middlewares\throttling.py", line 59, in on_process_message
    await self.message_throttled(message, t)
  File "app\middlewares\throttling.py", line 94, in message_throttled
    await dispatcher.release_key(key)
  File app\lib\site-packages\aiogram\utils\deprecated.py", line 122, in wrapped
    return await func(*args, **kwargs)
  File "app\lib\site-packages\aiogram\utils\deprecated.py", line 122, in wrapped
    return await func(*args, **kwargs)
  File "app\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 1370, in release_key
    del bucket['key']
KeyError: 'key'

Steps to Reproduce

  1. await dispatcher.release_key('my_key')
@Olegt0rr Olegt0rr added bug Something is wrong with the framework confirmed This issue is confirmed and requires action labels May 12, 2022
@evgfilim1 evgfilim1 added the 2.x Issue or PR for legacy 2.x version label May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Issue or PR for legacy 2.x version bug Something is wrong with the framework confirmed This issue is confirmed and requires action
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants