Skip to content

Commit a6c87f1

Browse files
committed
cancel straggler tasks on stop()
1 parent f196c99 commit a6c87f1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

plugwise_usb/network/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,18 @@ async def stop(self) -> None:
553553
for task in self._discover_sed_tasks.values():
554554
if not task.done():
555555
task.cancel()
556+
if (
557+
hasattr(self, "_load_stragglers_task")
558+
and self._load_stragglers_task
559+
and not self._load_stragglers_task.done()
560+
):
561+
self._load_stragglers_task.cancel()
562+
if (
563+
hasattr(self, "_discover_stragglers_task")
564+
and self._discover_stragglers_task
565+
and not self._discover_stragglers_task.done()
566+
):
567+
self._discover_stragglers_task.cancel()
556568
self._is_running = False
557569
self._unsubscribe_to_protocol_events()
558570
await self._unload_discovered_nodes()

0 commit comments

Comments
 (0)