File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
custom_components/pyscript Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -175,12 +175,10 @@ async def start_triggers(event):
175175
176176 async def stop_triggers (event ):
177177 _LOGGER .debug ("stopping triggers" )
178- for global_ctx_name , global_ctx in GlobalContextMgr .items ():
179- if not global_ctx_name .startswith ("file." ):
180- continue
178+ for _ , global_ctx in GlobalContextMgr .items ():
181179 global_ctx .stop ()
182180 # tell reaper task to exit (after other tasks are cancelled)
183- Function .task_cancel ( None )
181+ await Function .reaper_stop ( )
184182
185183 hass .bus .async_listen (EVENT_HOMEASSISTANT_STARTED , start_triggers )
186184 hass .bus .async_listen (EVENT_HOMEASSISTANT_STOP , stop_triggers )
Original file line number Diff line number Diff line change @@ -92,6 +92,12 @@ async def task_cancel_reaper(reaper_q):
9292 cls .task_reaper_q = asyncio .Queue (0 )
9393 cls .task_cancel_repeaer = Function .create_task (task_cancel_reaper (cls .task_reaper_q ))
9494
95+ @classmethod
96+ async def reaper_stop (cls ):
97+ """Tell the reaper task to exit by sending a special task None."""
98+ cls .task_cancel (None )
99+ await cls .task_cancel_repeaer
100+
95101 @classmethod
96102 async def async_sleep (cls , duration ):
97103 """Implement task.sleep()."""
You can’t perform that action at this time.
0 commit comments