From 61ce9bc50ba801b051a4b32732bea2b4c022cb18 Mon Sep 17 00:00:00 2001 From: Josh Powers Date: Wed, 31 Jul 2024 07:30:13 -0600 Subject: [PATCH] fix(inputs.opcua): Reconnect if closed connection Rather than checking if we are only disconnected, we should also check if the connection is closed to try to reconnect. fixes: #15693 --- plugins/inputs/opcua/read_client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/inputs/opcua/read_client.go b/plugins/inputs/opcua/read_client.go index b6f2a0d5a2b61..b765ff72d1c13 100644 --- a/plugins/inputs/opcua/read_client.go +++ b/plugins/inputs/opcua/read_client.go @@ -91,7 +91,7 @@ func (o *ReadClient) Connect() error { } func (o *ReadClient) ensureConnected() error { - if o.State() == opcua.Disconnected { + if o.State() == opcua.Disconnected || o.State() == opcua.Closed { return o.Connect() } return nil