Settings
Retry
Configure automatic retry behavior for failed requests
Overview
The Gbox SDK automatically retries certain types of failed requests to improve reliability. By default, retry is disabled (0 retries), but you can configure this behavior based on your needs.
Automatic Retry Conditions
The SDK will automatically retry requests that fail due to:
- Connection errors (network connectivity issues)
- 408 Request Timeout
- 409 Conflict
- 429 Rate Limit
- 5xx Server Errors (500, 502, 503, etc.)
Configuration
Global Retry Settings
Configure retry behavior when initializing the SDK:
Per-Request Retry Settings
Override retry settings for specific requests:
Retry Behavior
Exponential Backoff
The SDK uses exponential backoff between retries:
- 1st retry: ~1 second delay
- 2nd retry: ~2 seconds delay
- 3rd retry: ~4 seconds delay
- And so on…
Example Usage
Best Practices
- Start with low retry counts (2-3) and increase if needed
- Use higher retry counts for critical operations
- Set appropriate timeouts to avoid long waits
- Handle final failures gracefully in your application
- Monitor retry patterns to identify infrastructure issues
Disable Retries
To disable automatic retries completely: