method start no now blocks main cycle
This commit is contained in:
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "config_manager"
|
name = "config_manager"
|
||||||
version = "1.2.1"
|
version = "1.2.2"
|
||||||
description = "Config manager for building applications"
|
description = "Config manager for building applications"
|
||||||
authors = [
|
authors = [
|
||||||
{ name = "Aleksei Zosimov", email = "lesha.spb@gmail.com" }
|
{ name = "Aleksei Zosimov", email = "lesha.spb@gmail.com" }
|
||||||
|
|||||||
@@ -115,8 +115,8 @@ class ConfigManager:
|
|||||||
self.logger.error("start() must be called from within an async context")
|
self.logger.error("start() must be called from within an async context")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
self._task = self._loop.create_task(self._run())
|
self.logger.info("ConfigManager starting and awaiting _run()")
|
||||||
self.logger.info("ConfigManager task created")
|
await self._run()
|
||||||
|
|
||||||
|
|
||||||
async def stop(self) -> None:
|
async def stop(self) -> None:
|
||||||
|
|||||||
@@ -21,8 +21,10 @@ class MyApp(ConfigManager):
|
|||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
app = MyApp("config.yaml")
|
app = MyApp("config.yaml")
|
||||||
await app.start()
|
|
||||||
logger.info("App started")
|
logger.info("App started")
|
||||||
|
await app.start()
|
||||||
|
|
||||||
|
logger.info("App finished")
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user