Skip to content

Commit

Permalink
fix: Do not return on disconnect to avoid breaking reconnect (#9524)
Browse files Browse the repository at this point in the history
(cherry picked from commit 249bcd2)
  • Loading branch information
srebhan authored and reimda committed Aug 18, 2021
1 parent 85ca991 commit dbc128e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion plugins/inputs/opcua/opcua_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ func Connect(o *OpcUA) error {

if o.client != nil {
if err := o.client.CloseSession(); err != nil {
return err
// Only log the error but to not bail-out here as this prevents
// reconnections for multiple parties (see e.g. #9523).
o.Log.Errorf("Closing session failed: %v", err)
}
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/opcua/opcua_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/influxdata/telegraf/config"
"github.com/influxdata/telegraf/testutil"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -44,7 +45,6 @@ func TestClient1Integration(t *testing.T) {
o.SecurityPolicy = "None"
o.SecurityMode = "None"
o.Log = testutil.Logger{}

for _, tags := range testopctags {
o.RootNodes = append(o.RootNodes, MapOPCTag(tags))
}
Expand Down

0 comments on commit dbc128e

Please sign in to comment.