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

Function Throttle

middleware/throttle.go:32–34  ·  middleware/throttle.go::Throttle

Throttle is a middleware that limits number of currently processed requests at a time across all users. Note: Throttle is not a rate-limiter per user, instead it just puts a ceiling on the number of current in-flight requests being processed from the point from where the Throttle middleware is mount

(limit int)

Source from the content-addressed store, hash-verified

30// instead it just puts a ceiling on the number of current in-flight requests
31// being processed from the point from where the Throttle middleware is mounted.
32func Throttle(limit int) func(http.Handler) http.Handler {
33 return ThrottleWithOpts(ThrottleOpts{Limit: limit, BacklogTimeout: defaultBacklogTimeout})
34}
35
36// ThrottleBacklog is a middleware that limits number of currently processed
37// requests at a time and provides a backlog for holding a finite number of

Callers 1

mainFunction · 0.92

Calls 1

ThrottleWithOptsFunction · 0.85

Tested by

no test coverage detected