@@ -56,7 +56,8 @@ Additional Subsystems
5656Startup
5757-------
5858
59- The top-level entrypoint is ``appdaemon.__main__.main ``, which uses :py:mod: `argparse ` to parse the launch arguments.
59+ The top-level entrypoint is :py:func: `appdaemon.__main__.main `, which uses :py:mod: `argparse ` to parse the launch
60+ arguments.
6061
6162The :py:class: `~appdaemon.__main__.ADMain ` class primarily provides a :py:ref: `context manager<context-managers> ` that
6263can be used with a :py:keyword: `with statement<with> `. This contains an :py:class: `~contextlib.ExitStack ` instance that
@@ -67,10 +68,11 @@ to run in the correct order, which is the reverse order that the contexts were e
6768Contexts
6869~~~~~~~~
6970
70- The various context managers that get entered as AppDaemon is started include the logic for following steps. Some of these
71- are entered as part of the ``ADMain `` context, and some are entered in the :py:class: `~appdaemon.__main__.ADMain.run `
72- method. All of them are exited in reverse order as the :py:class: `~contextlib.ExitStack ` is closed, which happens when
73- ``ADMain `` context is exited.
71+ The various context managers that get entered as AppDaemon starts include the logic for following steps. Some of these
72+ are entered as part of the :py:class: `~appdaemon.__main__.ADMain ` context, and some are entered in the
73+ :py:class: `~appdaemon.__main__.ADMain.run ` method. All of them are exited in reverse order as the
74+ :py:class: `~contextlib.ExitStack ` is closed, which happens when the :py:class: `~appdaemon.__main__.ADMain ` context
75+ exits.
7476
7577 * Backstop logic to catch any exceptions and log them more prettily.
7678 * Creates a PID file for the duration of the context, if necessary/applicapable.
@@ -138,7 +140,7 @@ AppDaemon shutdown is globally indicated by the stop :py:class:`~asyncio.Event`
138140 import contextlib
139141
140142 async def loop (self ):
141- while not self .AD .stopping :
143+ while not self .AD .stop_event.is_set() :
142144 ... # Do stuff
143145 with contextlib.suppress(asyncio.TimeoutError):
144146 await asyncio.wait_for(self .AD .stop_event.wait(), timeout = 1 )
0 commit comments