Type rate as uint64

This commit is contained in:
Tomás Senart
2013-08-16 20:08:10 +02:00
parent e9fc844fd1
commit a2d4d25dec
2 changed files with 6 additions and 6 deletions

View File

@@ -11,7 +11,7 @@ import (
// TODO: Add timeouts
type Client struct {
http.Client
rate uint
rate uint64
}
// Response represents the metrics we want out of an http.Response
@@ -25,12 +25,12 @@ type Response struct {
}
// NewClient returns an initialized Client
func NewClient(rate uint) *Client {
func NewClient(rate uint64) *Client {
return &Client{http.Client{}, rate}
}
// Drill loops over the passed reqs channel and executes each request.
// It is throttled to the qps specified in the initializer
// It is throttled to the rate specified in the initializer
func (c *Client) Drill(reqs chan *http.Request, res chan *Response) {
throttle := time.Tick(time.Duration(1e9 / c.rate))
for req := range reqs {