SIENTIAPDE-1205
Refactor OpcRepository and update tests for async handling - Removed the shutdown method from OpcRepository and adjusted the disconnect logic. - Updated tests in test_activities.py and test_opc.py to support async shutdown functionality. - Enhanced test cases in test_opc_repository.py to ensure proper async behavior and error handling in OpcRepository methods.
This commit is contained in:
@@ -158,16 +158,6 @@ class OpcRepository():
|
||||
f"Failed to disconnect from OPC server: {e}", self.metadata)
|
||||
self.client = None
|
||||
|
||||
def shutdown(self):
|
||||
"""
|
||||
Disconnects from the OPC server when the object is destroyed.
|
||||
"""
|
||||
try:
|
||||
asyncio.run(self.disconnect())
|
||||
except Exception as e:
|
||||
self.logger.custom_error(
|
||||
f"Error in destructor: {e}", self.metadata)
|
||||
|
||||
async def validate_connection(self) -> tuple[bool, dict[str, Any]]:
|
||||
"""
|
||||
Validates the connection to the OPC server using protocol state checking.
|
||||
|
||||
Reference in New Issue
Block a user