-
-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
Contentstack has a 10 requests/second rate limit. When using this SDK with Terraform (which makes concurrent requests), we constantly hit 429 errors that cause the whole operation to fail.
The SDK currently just returns "Unhandled StatusCode: 429" instead of handling these errors properly.
This is blocking our Terraform automation. Related issue: labd/terraform-provider-contentstack#3
What we need
- Rate limiting - throttle requests to stay under the API limit
- Retry logic - automatically retry 429 responses with backoff
- Configuration options - let users adjust the limits
Suggested approach
Add these fields to ClientConfig
:
RateLimit float64 // requests per second, default 10
RateBurst int // burst size, default 10
MaxRetries int // retry attempts, default 3
When a 429 happens, wait and retry with exponential backoff (1s, 2s, 4s, etc).
Example usage
cfg := management.ClientConfig{
BaseURL: "https://api.contentstack.io",
AuthToken: "token",
RateLimit: 8.0, // be conservative
MaxRetries: 3,
}
This would make the SDK much more reliable for automation tools like Terraform that need to make multiple concurrent requests.
Happy to contribute a PR if this sounds good!
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request