fix: use provider-specific readiness timeouts
CI / test (push) Failing after 25s
CI / test (pull_request) Failing after 23s

This commit is contained in:
m
2026-08-22 20:52:40 +03:00
parent 4086b75224
commit 4a3d348e39
6 changed files with 53 additions and 6 deletions
+6 -1
View File
@@ -29,6 +29,7 @@ type Probe struct {
Name string
Check func(context.Context) error
Optional bool
Timeout time.Duration
}
type Result struct {
@@ -56,7 +57,11 @@ func (h ReadinessHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if probe.Check == nil {
result.State, result.Reason, result.Detail = "DEGRADED", "PROBE_NOT_CONFIGURED", "probe is not configured"
} else {
ctx, cancel := context.WithTimeout(r.Context(), timeout)
probeTimeout := timeout
if probe.Timeout > 0 {
probeTimeout = probe.Timeout
}
ctx, cancel := context.WithTimeout(r.Context(), probeTimeout)
err := probe.Check(ctx)
cancel()
if err != nil {