Skip to content

Commit

Permalink
Merge pull request #71 from SINTEF-9012/learning-factory
Browse files Browse the repository at this point in the history
OPC-UA: improved connection stability
  • Loading branch information
tiptr committed Sep 25, 2022
2 parents 1e1f1f6 + 8cb779b commit b266ad7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion backend/runtime_connections/opcua/OpcuaRuntimeConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,14 @@ def __start_connection(self):
Blocking until the connection is successfull!
:return:
"""
if self._opcua_client is not None:
self._opcua_client.disconnect()
self._opcua_client = None
while self._opcua_client is None and self.thread_stop == False:
try:
logger.info(f"Trying to connect to OPC UA: opc.tcp://{self.host}:{self.port}")
logger.info(
f"Trying to connect to OPC UA: opc.tcp://{self.host}:{self.port}"
)
self._opcua_client = asyncua.sync.Client(
url=f"opc.tcp://{self.host}:{self.port}",
tloop=self._asyncua_treadloop,
Expand Down

0 comments on commit b266ad7

Please sign in to comment.