Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Conversation

@jolorke
Copy link
Contributor

@jolorke jolorke commented Apr 3, 2024

Turned out to be a duplicate of this:
#58

But this one also contains testcases :)

jolorke added 2 commits April 3, 2024 17:19
…associated queue from the channel in case of a raised exception inside the context manager (e.g. being used inside a generator that gets closed raising GeneratorExit)
@jolorke jolorke force-pushed the fix/unsubscribe_not_deleting_queue branch from 5630017 to 3015fff Compare April 3, 2024 15:20
@alex-oleshkevich alex-oleshkevich self-requested a review April 3, 2024 15:57
@alex-oleshkevich
Copy link
Contributor

I get this exception when running pytest.
Python 3.11.8

Exception ignored in: <coroutine object Broadcast._listener at 0x7363387bac50>
Traceback (most recent call last):
  File "/home/alex/projects/broadcaster/broadcaster/_base.py", line 74, in _listener
    event = await self._backend.next_published()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alex/projects/broadcaster/broadcaster/_backends/memory.py", line 30, in next_published
    event = await self._published.get()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/queues.py", line 160, in get
    getter.cancel()  # Just in case getter is not done yet.
    ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 762, in call_soon
    self._check_closed()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 520, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending name='Task-11' coro=<Broadcast._listener() done, defined at /home/alex/projects/broadcaster/broadcaster/_base.py:72> wait_for=<Future cancelled>>
Exception ignored in: <coroutine object Broadcast._listener at 0x7363387bb3d0>
Traceback (most recent call last):
  File "/home/alex/projects/broadcaster/broadcaster/_base.py", line 74, in _listener
    event = await self._backend.next_published()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alex/projects/broadcaster/broadcaster/_backends/memory.py", line 30, in next_published
    event = await self._published.get()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/queues.py", line 160, in get
    getter.cancel()  # Just in case getter is not done yet.
    ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 762, in call_soon
    self._check_closed()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 520, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending name='Task-13' coro=<Broadcast._listener() done, defined at /home/alex/projects/broadcaster/broadcaster/_base.py:72> wait_for=<Future cancelled>>

@jolorke
Copy link
Contributor Author

jolorke commented Apr 4, 2024

Thanks!

@jolorke jolorke deleted the fix/unsubscribe_not_deleting_queue branch April 4, 2024 07:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants