Skip to content

Commit

Permalink
Make API client retry on rate-limit errors
Browse files Browse the repository at this point in the history
  • Loading branch information
janeczku committed May 24, 2016
1 parent ca39723 commit ddc9440
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions vultr.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ type Driver struct {
}

const (
defaultOS = 159
defaultRegion = 1
defaultPlan = 29
defaultSSHuser = "root"
defaultOS = 159
defaultRegion = 1
defaultPlan = 29
defaultSSHuser = "root"
clientMaxRetries = 5
)

// GetCreateFlags registers the flags this driver adds to
Expand Down Expand Up @@ -410,7 +411,7 @@ func (d *Driver) Kill() error {
func (d *Driver) getClient() *vultr.Client {
log.Infof("getting client")
if d.client == nil {
d.client = vultr.NewClient(d.APIKey, nil)
d.client = vultr.NewClient(d.APIKey, &vultr.Options{MaxRetries: clientMaxRetries})
}
return d.client
}
Expand Down

0 comments on commit ddc9440

Please sign in to comment.