You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- feat: RFC 9110 compliant Retry-After header support with exponential backoff and jitter
7
-
- feat: Enhanced retry strategy with delay calculation
8
-
- feat: Retry-After header value exposed in error objects for better observability
9
-
- feat: Input validation for Configuration.minimumRetryDelay() to prevent negative values
10
-
- feat: Default value (100ms) now explicitly set for minimumRetryDelay configuration
11
-
12
-
### Changed
13
-
-**BREAKING**: Maximum allowable retry count is now enforced at 15 (default remains 3)
14
-
-**BREAKING**: FgaError now exposes Retry-After header value via getRetryAfterHeader() method
15
-
-**BREAKING**: Configuration.minimumRetryDelay() now requires non-null values and validates input, throwing IllegalArgumentException for null or negative values
16
-
17
-
### Technical Details
18
-
- Implements RFC 9110 compliant Retry-After header parsing (supports both integer seconds and HTTP-date formats)
19
-
- Adds exponential backoff with jitter (base delay: 2^retryCount * 100ms, capped at 120 seconds)
20
-
- Validates Retry-After values between 1-1800 seconds (30 minutes maximum)
21
-
- Prioritizes Retry-After header delays over exponential backoff when present
22
-
- Unified retry behavior: All requests retry on 429s and 5xx errors (except 501 Not Implemented)
23
-
24
-
**Migration Guide**:
25
-
- Update error handling code if using FgaError properties - new getRetryAfterHeader() method available
26
-
- Note: Maximum allowable retries is now enforced at 15 (validation added to prevent exceeding this limit)
27
-
-**IMPORTANT**: Configuration.minimumRetryDelay() now requires non-null values and validates input - ensure you're not passing null or negative Duration values, as this will now throw IllegalArgumentException. Previously null values were silently accepted and would fall back to default behavior at runtime.
We strongly recommend you initialize the `OpenFgaClient` only once and then re-use it throughout your app, otherwise you will incur the cost of having to re-initialize multiple times or at every request, the cost of reduced connection pooling and re-use, and would be particularly costly in the client credentials flow, as that flow will be preformed on every request.
127
127
128
-
> The `Client` will by default retry API requests up to 3 times. Rate limiting (429) errors are always retried. Server errors (5xx) are retried for all operations, with delay calculation using `Retry-After` headers when provided or exponential backoff as fallback.
128
+
> The `Client` will by default retry API requests up to 3 times on 429 and 5xx errors.
129
129
130
130
#### No Credentials
131
131
@@ -714,7 +714,7 @@ response.getResult() = [{
714
714
715
715
If you are using an OpenFGA version less than 1.8.0, you can use `clientBatchCheck`,
716
716
which calls `check` in parallel. It will return `allowed: false` if it encounters an error, and will return the error in the body.
717
-
If 429s are encountered, the underlying check will retry up to 3 times. For 5xx errors, all requests will retry with delay calculation using `Retry-After` headers when provided or exponential backoff as fallback.
717
+
If 429s or 5xxs are encountered, the underlying check will retry up to 3 times before giving up.
The SDK implements RFC 9110 compliant retry behavior with support for the `Retry-After` header. By default, the SDK will automatically retry failed requests up to **3 times** with delay calculation (maximum allowable: 15 retries).
968
+
If a network request fails with a 429 or 5xx error from the server, the SDK will automatically retry the request up to 3 times with a minimum wait time of 100 milliseconds between each attempt.
969
969
970
-
#### Retry Behavior
971
-
972
-
**Rate Limiting (429 errors):** Always retried regardless of HTTP method.
973
-
974
-
**Server Errors (5xx):** All requests are retried on 5xx errors (except 501 Not Implemented) regardless of HTTP method:
975
-
- **All operations** (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS): Always retried on 5xx errors with delay calculation
976
-
977
-
#### Delay Calculation
978
-
979
-
1. **Retry-After header present**: Uses the server-specified delay (supports both integer seconds and HTTP-date formats)
980
-
2. **No Retry-After header**: Uses exponential backoff with jitter (base delay: 2^retryCount * 100ms, capped at 120 seconds)
981
-
3. **Minimum delay**: Respects the configured `minimumRetryDelay` as a floor value
982
-
983
-
#### Configuration
984
-
985
-
Customize retry behavior using the `ClientConfiguration` builder. The SDK enforces a maximum of 15 retries to prevent accidental server overload:
986
-
987
-
**⚠️ Breaking Changes:**
988
-
- Configuration validation now prevents setting `maxRetries` above 15
989
-
- `FgaError` now exposes the `Retry-After` header value via `getRetryAfterHeader()`
970
+
To customize this behavior, call `maxRetries` and `minimumRetryDelay` on the `ClientConfiguration` builder. `maxRetries` determines the maximum number of retries (up to 15), while `minimumRetryDelay` sets the minimum wait time between retries in milliseconds.
0 commit comments