mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-11 02:26:10 +00:00
* s3api: add optional request interceptor to circuit breaker Add an optional Interceptor func(next http.HandlerFunc, action string) http.HandlerFunc field on CircuitBreaker, applied at the very top of Limit() -- before upload concurrency limiting and before the 'if !cb.Enabled' early return -- so it runs for every route regardless of breaker state. It is nil by default (no behavior change). An interceptor may reject a request (write its own response and skip next) or wrap next to observe/shape it. This provides a single per-request extension point at the existing per-route chokepoint (cb.Limit already wraps nearly every S3 route), useful for tracing, auditing, or request rate limiting without touching the route table. * s3api: evaluate circuit breaker interceptor per request Move the Interceptor nil-check into the returned handler so it is consulted per request instead of captured at registration time. This: - lets the interceptor be installed after registerRouter runs (handlers are built during construction, before request-time dependencies exist), and - avoids dereferencing a nil CircuitBreaker at registration time, which panicked tests that register routes on a server with a nil cb (e.g. TestRouting_STSWithQueryParams). Adds a regression test for installing the interceptor after Limit() returns.