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

Method writeTo

cmd/cache-proxy/proxy.go:637–648  ·  view source on GitHub ↗

writeTo replays the captured origin response onto w. Any header the origin set that isn't a hop-by-hop is forwarded; status code and body follow.

(w http.ResponseWriter)

Source from the content-addressed store, hash-verified

635 if backoff <= 0 {
636 return 0
637 }
638 if maxBackoff > 0 && backoff > maxBackoff {
639 backoff = maxBackoff
640 }
641 return time.Duration(float64(backoff) * (0.5 + rand.Float64()*0.5))
642}
643
644func (p *CacheProxy) fetchOriginOnce(cacheKey string, r *http.Request) (int64, string, error) {
645 timeout := p.originTimeout
646 if timeout <= 0 {
647 timeout = defaultOriginTimeout
648 }
649 ctx, cancel := context.WithTimeout(r.Context(), timeout)
650 defer cancel()
651

Callers 1

HandleProxyMethod · 0.95

Calls 3

AddMethod · 0.80
HeaderMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected