Files
DenozordecandCursor f8e0520817 feat(httpapi): harden control plane and speed up prefix refresh
Очередь job получила lease и fencing, телеметрия и прогресс deploy сохраняются, ревизия пишет manifest входов. Обновление префиксов не переписывает неизменённый снимок, большие наборы идут через COPY, а устаревшая ревизия не попадает в deploy. Бандл ноды кэшируется, prune и постановка job больше не держат горячий путь.

Co-authored-by: Cursor <[email protected]>
2026-11-02 17:23:59 +07:00

36 lines
1.0 KiB
Go

package pipeline
import (
"net/http"
"evobgp/internal/httpclient"
)
// pipelineTransport owns two reusable pools. Ordinary requests retain the
// explicitly configured DoH/RIPE policy; CDN entry points select the guarded pool.
type pipelineTransport struct {
general http.RoundTripper
cdn http.RoundTripper
}
func (t *pipelineTransport) RoundTrip(r *http.Request) (*http.Response, error) {
return t.general.RoundTrip(r)
}
func (t *pipelineTransport) CloseIdleConnections() {
for _, transport := range []http.RoundTripper{t.general, t.cdn} {
if closer, ok := transport.(interface{ CloseIdleConnections() }); ok {
closer.CloseIdleConnections()
}
}
}
// NewPipelineHTTPClient preserves configured DoH/RIPE access while giving CDN
// fetches a separate reusable guarded transport without an unbounded client cache.
func NewPipelineHTTPClient() *http.Client {
client := httpclient.New(httpclient.DefaultTimeout)
cdn := NewCDNHTTPClient()
client.Transport = &pipelineTransport{general: client.Transport, cdn: cdn.Transport}
return client
}