MCPcopy
hub / github.com/go-chi/chi / ThrottleBacklog

Function ThrottleBacklog

middleware/throttle.go:39–41  ·  view source on GitHub ↗

ThrottleBacklog is a middleware that limits number of currently processed requests at a time and provides a backlog for holding a finite number of pending requests.

(limit, backlogLimit int, backlogTimeout time.Duration)

Source from the content-addressed store, hash-verified

37// requests at a time and provides a backlog for holding a finite number of
38// pending requests.
39func ThrottleBacklog(limit, backlogLimit int, backlogTimeout time.Duration) func(http.Handler) http.Handler {
40 return ThrottleWithOpts(ThrottleOpts{Limit: limit, BacklogLimit: backlogLimit, BacklogTimeout: backlogTimeout})
41}
42
43// ThrottleWithOpts is a middleware that limits number of currently processed requests using passed ThrottleOpts.
44func ThrottleWithOpts(opts ThrottleOpts) func(http.Handler) http.Handler {

Callers 5

TestThrottleBacklogFunction · 0.85
TestThrottleMaximumFunction · 0.85
BenchmarkThrottleFunction · 0.85

Calls 1

ThrottleWithOptsFunction · 0.85

Tested by 5

TestThrottleBacklogFunction · 0.68
TestThrottleMaximumFunction · 0.68
BenchmarkThrottleFunction · 0.68