Commit bb9b718
committed
connections.pybricks: fix leaking tasks if race_disconnect() is canceled
If the `race_disconnect()` method is canceled while waiting for either
of the tasks, there is nothing that ever awaits the tasks, so we get
errors like:
2025-09-09 21:22:25,946: ERROR: asyncio: Task was destroyed but it is pending!
task: <Task pending name='race_disconnect: Queue.get' coro=<Queue.get() done, defined at python\3.13.0\Lib\asyncio\queues.py:172> wait_for=<Future cancelled>>
2025-09-09 21:22:25,947: ERROR: asyncio: Task was destroyed but it is pending!
task: <Task pending name='Task-21' coro=<Event.wait() done, defined at python\3.13.0\Lib\asyncio\locks.py:200> wait_for=<Future pending cb=[Task.task_wakeup()]>>
To avoid this, cancel the tasks if anything goes wrong while waiting.1 parent b6da663 commit bb9b718
1 file changed
+9
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
356 | 361 | | |
357 | 362 | | |
358 | 363 | | |
| |||
0 commit comments