SIENTIAPDE-1314
Refactor OPC Write Method and Comment Out Error Handling Logic - Reformatted the `write_opc_data` method for improved readability by adjusting its signature. - Commented out the error handling logic in `OpcRepository` related to disconnection due to multiple errors, preserving the original functionality for future reference. - Updated tests to reflect the commented-out error handling, ensuring clarity in the testing process.
This commit is contained in:
@@ -263,22 +263,22 @@ class OpcRepository(BaseActivity):
|
||||
if self.client is None:
|
||||
return await self.connect()
|
||||
|
||||
if self.error_count > 5:
|
||||
self.logger.custom_warning(
|
||||
f'OPC server {self.id} will be disconnected due to multiple errors', self.metadata
|
||||
)
|
||||
try:
|
||||
await self.disconnect()
|
||||
except Exception as e:
|
||||
trace = traceback.format_exc()
|
||||
self.logger.custom_error(
|
||||
f'Failed to disconnect from OPC server: {e}', self.metadata
|
||||
)
|
||||
self.logger.custom_error(trace, self.metadata)
|
||||
self.logger.custom_info(
|
||||
f'Attempting to reconnect to OPC server {self.id}...', self.metadata
|
||||
)
|
||||
return await self.connect()
|
||||
# if self.error_count > 5:
|
||||
# self.logger.custom_warning(
|
||||
# f'OPC server {self.id} will be disconnected due to multiple errors', self.metadata
|
||||
# )
|
||||
# try:
|
||||
# await self.disconnect()
|
||||
# except Exception as e:
|
||||
# trace = traceback.format_exc()
|
||||
# self.logger.custom_error(
|
||||
# f'Failed to disconnect from OPC server: {e}', self.metadata
|
||||
# )
|
||||
# self.logger.custom_error(trace, self.metadata)
|
||||
# self.logger.custom_info(
|
||||
# f'Attempting to reconnect to OPC server {self.id}...', self.metadata
|
||||
# )
|
||||
# return await self.connect()
|
||||
|
||||
# Check if client is connected using asyncua's connection state
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user