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)
| 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. |
| 32 | func 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 |
no test coverage detected