Skip to content

Commit

Permalink
feat(uat): fix connect bug on windows for python paho client (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
eschastlivtsev authored Jul 27, 2023
1 parent dc9b0ac commit d87a777
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions uat/custom-components/client-python-paho/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,7 @@ def print_usage(self):

if __name__ == "__main__":
main_object = Main()
if sys.version_info >= (3, 8) and sys.platform.lower().startswith("win"):
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
rc = asyncio.run(main_object.main())
sys.exit(rc)
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def register_connection(self, mqtt_connection: MqttConnection) -> int:
Returns id of connection
"""
while True:
connection_id = self.__connection_id_next
self.__connection_id_next += 1
connection_id = self.__connection_id_next

if connection_id not in self.__connections:
self.__connections[connection_id] = mqtt_connection
Expand Down

0 comments on commit d87a777

Please sign in to comment.