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
  • Loading branch information
srebhan authored Aug 5, 2021
1 parent 1659758 commit 249bcd2
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 249bcd2

Please sign in to comment.