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)
| 37 | // requests at a time and provides a backlog for holding a finite number of |
| 38 | // pending requests. |
| 39 | func 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. |
| 44 | func ThrottleWithOpts(opts ThrottleOpts) func(http.Handler) http.Handler { |