Skip to content

Commit 3b9e0d4

Browse files
committed
select: Don't try selecting on a closed event loop
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent fb83a3f commit 3b9e0d4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/frequenz/channels/_select.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,9 @@ async def select( # noqa: DOC503
430430
receivers_map: dict[str, Receiver[Any]] = {str(hash(r)): r for r in receivers}
431431
pending: set[asyncio.Task[bool]] = set()
432432

433+
if asyncio.get_event_loop().is_closed():
434+
raise SelectError("Cannot select on a closed event loop")
435+
433436
try:
434437
for name, recv in receivers_map.items():
435438
pending.add(asyncio.create_task(recv.ready(), name=name))

0 commit comments

Comments
 (0)