func()

in pkg/handlers/probe_handler.go [42:58]


func (p *probeHandler) HandleProbe(resp http.ResponseWriter, request *http.Request) {
	ctx, cancel := context.WithTimeout(request.Context(), p.probeTimeout)
	log := logger.FromContext(ctx)
	defer cancel()

	err := p.probeAddrs(ctx)

	if err == nil {
		resp.WriteHeader(http.StatusOK)
	} else if errors.Is(err, context.DeadlineExceeded) {
		resp.WriteHeader(http.StatusRequestTimeout)
	} else {
		resp.WriteHeader(http.StatusInternalServerError)
		log.Errorf("InternalServerError: %v", err)
		_, _ = resp.Write([]byte("Internal Server Error occurred"))
	}
}