Documentation ¶
Index ¶
Constants ¶
View Source
const (
DefaultTimeout = 30 * time.Second
)
Variables ¶
View Source
var ErrQueueingTimedout = &errQueueingTimedout{errors.New("queueing timedout")}
View Source
var ErrTooManyRequests = &errTooManyRequests{errors.New("too many requests queued")}
Functions ¶
func QueueRequests ¶
func QueueRequests(name string, h http.Handler, limit, queueLimit uint, queueTimeout time.Duration) http.Handler
QueueRequests creates a new request queue name specifies the name of queue, used to label Prometheus metrics
Don't call QueueRequests twice with the same name argument!
h specifies a http.Handler which will handle the queue requests limit specifies number of requests run concurrently queueLimit specifies maximum number of requests that can be queued queueTimeout specifies the time limit of storing the request in the queue
Types ¶
Click to show internal directories.
Click to hide internal directories.