rearrange start to use asyncio

Create an asyncio loop then start confservers, mqtt, and mqtthelper in loop.

TODO: Re-work xmpp for asyncio
This commit is contained in:
Brian Martin 2019-03-21 21:19:29 -04:00
parent d5449961f3
commit a296f038a7
3 changed files with 48 additions and 13 deletions

View file

@ -73,6 +73,10 @@ class MQTTHelperBot:
async def start_helper_bot(self):
try:
self.Client = MQTTClient(
client_id=self.client_id, config={"check_hostname": False}
)
await self.Client.connect(
"mqtts://{}:{}/".format(self.address[0], self.address[1]),
cafile=bumper.ca_cert,
@ -84,6 +88,8 @@ class MQTTHelperBot:
]
)
asyncio.ensure_future(self.get_msg())
except Exception as e:
helperbotlog.exception("{}".format(e))