Skip to content

Commit

Permalink
simplify readiness check for event-publisher-proxy (#18307)
Browse files Browse the repository at this point in the history
* dont-deploy-epp-without-nats

* bump image

* undo bump image of ec

* change to disconnected

* simplify

* reenable nats
  • Loading branch information
friedrichwilken authored Oct 17, 2023
1 parent b0bd82f commit 6c4c008
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions pkg/sender/jetstream/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,13 @@ package jetstream
import (
"net/http"

"github.com/nats-io/nats.go"

"github.com/kyma-project/kyma/components/event-publisher-proxy/pkg/handler/health"
)

// ReadinessCheck returns an instance of http.HandlerFunc that checks the readiness of the given NATS Handler.
// It checks the NATS server connection status and reports 2XX if connected, otherwise reports 5XX.
// It panics if the given NATS Handler is nil.
func (s *Sender) ReadinessCheck(w http.ResponseWriter, _ *http.Request) {
if status := s.ConnectionStatus(); status != nats.CONNECTED {
s.namedLogger().Error("Readiness check failed: not connected to nats server")
w.WriteHeader(health.StatusCodeNotHealthy)
return
}
w.WriteHeader(health.StatusCodeHealthy)
}

Expand Down

0 comments on commit 6c4c008

Please sign in to comment.