feat: wire the circuit breaker into the proxy fetch path #90
Reference in New Issue
Block a user
Delete Branch "benvin/wire-circuit-breaker"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #74
Why
internal/proxy/circuit.goimplemented and tested a circuit breaker, but nothing ever called it — a repeatedly-failing upstream was still hit on every request.Changes
CircuitBreakerinNewEngine.Engine.Fetch: short-circuit when the breaker is open (serve stale from the store if present, otherwise return 503),RecordFailureon eachUpstreamError, andRecordSuccesson a successful fetch.Validation
go test ./internal/proxy/andmake e2epass.6d6cc4b78ctoad6dfbdc5bRebased onto latest master (resolved engine.go conflicts against the batched access-log writer and the streaming/HEAD changes). Depends on #96 (master does not currently compile); verified this branch builds + passes make e2e on top of #96.