INNER CODE UNIT · Go
newGatewayServer
bhope/hedge · benchmark/streaming/main.go:124
func newGatewayServer(hits *atomic.Int64) *httptest.Server {
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
hits.Add(1)
select {
case <-time.After(sampleTTFT()):
case <-r.Context().Done():
return
}
w.WriteHeader(http.StatusOK)
w.Write([]byte("tok")) //nolint:errcheck
}))
}
// ── transports ───────────────────────────────────────────────────────────────
// ttfbTransport records a sketch sample at header-receipt time — the instant
// RoundTrip returns — matching the pre-fix behaviour of hedge.New. On a
// streaming server this produces near-zero observations regardless of how