MCPcopy Create free account
hub / github.com/PostHog/duckgres / jitteredOriginRetryDelay

Function jitteredOriginRetryDelay

cmd/cache-proxy/proxy.go:460–468  ·  view source on GitHub ↗
(backoff, maxBackoff time.Duration)

Source from the content-addressed store, hash-verified

458 // no upstream status exists, so 502 Bad Gateway is the right answer
459 // here — and it's also the one DuckDB's httpfs treats as transient.
460 slog.Error("Failed to fetch.", "url", r.URL.String(), "range", rangeHeader, "error", err)
461 http.Error(w, err.Error(), http.StatusBadGateway)
462 return
463 }
464
465 // fetchDedup already committed the body to disk under cacheKey. Serve it by
466 // streaming from the file (openFile, not Open — the miss was already counted,
467 // so this must not also register a hit).
468 reader, size, ok := p.store.openFile(cacheKey)
469 if !ok {
470 // The entry was evicted in the narrow window between commit and serve.
471 // 502 so httpfs retries rather than receiving a truncated body.

Callers 1

fetchOriginMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected