Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RequestFunc ¶
type RequestFunc func(client *http.Client, done chan<- RequestResult)
RequestFunc is a function that performs an HTTP request using the provided client, and sends its result to the given result channel.
type RequestQueue ¶
type RequestQueue struct {
// contains filtered or unexported fields
}
func NewRequestQueue ¶
func NewRequestQueue(rps int, burst int) *RequestQueue
NewRequestQueue creates a new rate-limited request queue. `rps` = requests per second, `burst` = burst capacity
func (*RequestQueue) Enqueue ¶
func (q *RequestQueue) Enqueue(job RequestFunc) <-chan RequestResult
Enqueue adds a new request to the queue and returns a result channel.
func (*RequestQueue) Shutdown ¶
func (q *RequestQueue) Shutdown()
Shutdown stops the queue and waits for the worker to finish.
type RequestResult ¶
RequestResult holds the result of a queued request.
Click to show internal directories.
Click to hide internal directories.