Skip to content

Commit

Permalink
change nats healtcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
lghinet committed Oct 15, 2021
1 parent 88a463c commit 63bed9c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/messaging/nats/nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,16 @@ func (n *natsStreamingPubSub) Close() error {
}

func (n *natsStreamingPubSub) IsHealthy() healthcheck.HealthResult {
if n.closed {
if n.closed ||
n.natStreamingConn == nil ||
n.natStreamingConn.NatsConn() == nil ||
n.natStreamingConn.NatsConn().Status() != nats.CONNECTED {
return healthcheck.HealthResult{
Status: healthcheck.Unhealthy,
Description: "nats pubsub connection is closed",
}
}

return healthcheck.HealthyResult
}

Expand Down

0 comments on commit 63bed9c

Please sign in to comment.