- fixed loosing connection to Pot task
This commit is contained in:
+9
-5
@@ -113,10 +113,13 @@ class MessageDispatcherSync(IConnection):
|
||||
|
||||
async def on_connect(self):
|
||||
if self.auto_subscribe:
|
||||
for handler in self.msg_handlers:
|
||||
key = handler.get_key()
|
||||
print("Would subscribe {}".format(key))
|
||||
asyncio.get_event_loop().run_in_executor(None, self.send, {'+': key})
|
||||
asyncio.get_event_loop().run_in_executor(None, self.subscribe)
|
||||
|
||||
def subscribe(self):
|
||||
for handler in self.msg_handlers:
|
||||
key = handler.get_key()
|
||||
print("Would subscribe {}".format(key))
|
||||
self.send({'+': key})
|
||||
|
||||
async def on_disconnect(self):
|
||||
pass
|
||||
@@ -132,7 +135,8 @@ class MessageDispatcherSync(IConnection):
|
||||
result = None
|
||||
try:
|
||||
result = await asyncio.get_event_loop().run_in_executor(None, self.state.get, True, 1.0)
|
||||
except:
|
||||
print("Send subscribe {}".format(result))
|
||||
except Exception as e:
|
||||
pass
|
||||
return result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user