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,11 +256,13 @@ func (target *NATSTarget) IsActive() (bool, error) {
if target.natsConn != nil && target.args.JetStream.Enable {
target.jstream, connErr = target.natsConn.JetStream()
if connErr != nil {
if connErr.Error() == nats.ErrNoServers.Error() {
return false, errNotConnected
}
return false, connErr
}
}
return true, nil
}