Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions yaqd-core/yaqd_core/_is_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,14 @@ def main(cls):
# Run the event loop
try:
asyncio.run(cls._main(config_filepath, config_file, args))
except asyncio.CancelledError:
pass
except KeyboardInterrupt:
asyncio.run(cls.shutdown_all(signal.SIGINT, loop=cls.loop))

@classmethod
async def _main(cls, config_filepath, config_file, args=None):
"""Parse command line arguments, run event loop."""
loop = asyncio.get_running_loop()
cls.loop = loop
if sys.platform.startswith("win"):
signals = ()
else:
Expand Down
7 changes: 7 additions & 0 deletions yaqd-fakes/yaqd_fakes/_fake_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,10 @@ async def _update_measurements(self):
out["measurement_id"] = self._measurement_id
self._measured = out
await asyncio.sleep(self._config["update_period"])

async def aclose(self):
await asyncio.sleep(0.1)
self.logger.info("finished async close routine")

def close(self):
asyncio.get_running_loop().create_task(self.aclose())
Loading