Adding error check for jetstream connection (#15252)

This commit is contained in:
Ray 2022-07-08 00:14:47 -06:00 committed by GitHub
parent cf9e3069f2
commit 3bdb92fcad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -256,10 +256,12 @@ func (target *NATSTarget) IsActive() (bool, error) {
if target.natsConn != nil && target.args.JetStream.Enable { if target.natsConn != nil && target.args.JetStream.Enable {
target.jstream, connErr = target.natsConn.JetStream() target.jstream, connErr = target.natsConn.JetStream()
if connErr.Error() == nats.ErrNoServers.Error() { if connErr != nil {
return false, errNotConnected if connErr.Error() == nats.ErrNoServers.Error() {
return false, errNotConnected
}
return false, connErr
} }
return false, connErr
} }
return true, nil return true, nil