diff --git a/cmd/queue/main.go b/cmd/queue/main.go index 4d11284f170b..d012a0c32a0d 100644 --- a/cmd/queue/main.go +++ b/cmd/queue/main.go @@ -319,7 +319,7 @@ func buildServer(ctx context.Context, env config, healthState *health.State, rp composedHandler = tracing.HTTPSpanMiddleware(composedHandler) } - composedHandler = health.ProbeHandler(healthState, rp.ProbeContainer, rp.IsAggressive(), tracingEnabled, composedHandler) + composedHandler = health.ProbeHandler(healthState, rp.ProbeContainer, tracingEnabled, composedHandler) composedHandler = network.NewProbeHandler(composedHandler) // We might want sometimes capture the probes/healthchecks in the request // logs. Hence we need to have RequestLogHandler to be the first one. diff --git a/cmd/queue/main_test.go b/cmd/queue/main_test.go index 71bc000671a6..27ebcbf180dc 100644 --- a/cmd/queue/main_test.go +++ b/cmd/queue/main_test.go @@ -149,7 +149,7 @@ func TestQueueTraceSpans(t *testing.T) { h := queue.ProxyHandler(breaker, network.NewRequestStats(time.Now()), true /*tracingEnabled*/, proxy) h(writer, req) } else { - h := health.ProbeHandler(healthState, tc.prober, true /* isAggressive*/, true /*tracingEnabled*/, nil) + h := health.ProbeHandler(healthState, tc.prober, true /*tracingEnabled*/, nil) req.Header.Set(network.ProbeHeaderName, tc.requestHeader) h(writer, req) } diff --git a/pkg/queue/health/handler.go b/pkg/queue/health/handler.go index 7bca57f51092..201187c228f7 100644 --- a/pkg/queue/health/handler.go +++ b/pkg/queue/health/handler.go @@ -29,7 +29,7 @@ const badProbeTemplate = "unexpected probe header value: " // ProbeHandler returns a http.HandlerFunc that responds to health checks if the // knative network probe header is passed, and otherwise delegates to the next handler. -func ProbeHandler(healthState *State, prober func() bool, isAggressive bool, tracingEnabled bool, next http.Handler) http.HandlerFunc { +func ProbeHandler(healthState *State, prober func() bool, tracingEnabled bool, next http.Handler) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { ph := network.KnativeProbeHeader(r) diff --git a/pkg/queue/health/handler_test.go b/pkg/queue/health/handler_test.go index dd66fd2a2df2..e26bf0b1a362 100644 --- a/pkg/queue/health/handler_test.go +++ b/pkg/queue/health/handler_test.go @@ -80,7 +80,7 @@ func TestProbeHandler(t *testing.T) { req.Header.Set(network.ProbeHeaderName, tc.requestHeader) } - h := ProbeHandler(healthState, tc.prober, true /* isAggressive*/, true /*tracingEnabled*/, incHandler) + h := ProbeHandler(healthState, tc.prober, true /*tracingEnabled*/, incHandler) h(writer, req) if got, want := writer.Code, tc.wantCode; got != want { diff --git a/pkg/queue/readiness/probe.go b/pkg/queue/readiness/probe.go index 100f16670826..2d8e0e16250f 100644 --- a/pkg/queue/readiness/probe.go +++ b/pkg/queue/readiness/probe.go @@ -97,8 +97,8 @@ func NewProbeWithHTTP2AutoDetection(v1p *corev1.Probe) *Probe { } } -// IsAggressive indicates whether the Knative probe with aggressive retries should be used. -func (p *Probe) IsAggressive() bool { +// shouldProbeAggressively indicates whether the Knative probe with aggressive retries should be used. +func (p *Probe) shouldProbeAggressively() bool { return p.PeriodSeconds == 0 } @@ -155,7 +155,7 @@ func (p *Probe) probeContainerImpl() bool { } func (p *Probe) doProbe(probe func(time.Duration) error) error { - if !p.IsAggressive() { + if !p.shouldProbeAggressively() { return probe(time.Duration(p.TimeoutSeconds) * time.Second) }