Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: godaddy - rate limiter add one token every second #4087

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions provider/godaddy/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ func NewClient(useOTE bool, apiKey, apiSecret string) (*Client, error) {
APISecret: apiSecret,
APIEndPoint: endpoint,
Client: &http.Client{},
Ratelimiter: rate.NewLimiter(rate.Every(60*time.Second), 60),
// Add one token every second
Ratelimiter: rate.NewLimiter(rate.Every(time.Second), 60),
Timeout: DefaultTimeout,
}

Expand All @@ -142,7 +143,7 @@ func (c *Client) Get(url string, resType interface{}) error {
return c.CallAPI("GET", url, nil, resType, true)
}

// Patch is a wrapper for the POST method
// Patch is a wrapper for the PATCH method
func (c *Client) Patch(url string, reqBody, resType interface{}) error {
return c.CallAPI("PATCH", url, reqBody, resType, true)
}
Expand All @@ -167,7 +168,7 @@ func (c *Client) GetWithContext(ctx context.Context, url string, resType interfa
return c.CallAPIWithContext(ctx, "GET", url, nil, resType, true)
}

// PatchWithContext is a wrapper for the POST method
// PatchWithContext is a wrapper for the PATCH method
func (c *Client) PatchWithContext(ctx context.Context, url string, reqBody, resType interface{}) error {
return c.CallAPIWithContext(ctx, "PATCH", url, reqBody, resType, true)
}
Expand Down
Loading