SDK Retries
Some SDKs implement automatic retry with exponential backoff.
SDK Retries
Some SDKs implement automatic retry with exponential backoff.
Default behavior
- Max retries: 3
- Initial delay: 1000ms
- Max delay: 30 seconds
- Backoff multiplier: 2
Retryable conditions
HTTP status codes
- 429: Rate limited
- 502: Bad gateway
- 503: Service unavailable
- 504: Gateway timeout
Network errors
- Connection refused
- Connection reset
- DNS resolution failure
- Timeout
Configuration
Node.js
import { AuthClient } from "@qnsp/auth-sdk";
const client = new AuthClient({
baseUrl: "http://localhost:8081",
apiKey: process.env.QNSP_API_KEY,
maxRetries: 5,
retryDelayMs: 1_000,
});
Rate limit handling
When rate limited (429):
- Check
Retry-Afterheader - Wait specified duration
- Retry request
SDKs that implement retries will:
- Read
Retry-After(if present) - Delay and retry up to
maxRetries
Disabling retries
import { AuthClient } from "@qnsp/auth-sdk";
const client = new AuthClient({
baseUrl: "http://localhost:8081",
apiKey: process.env.QNSP_API_KEY,
maxRetries: 0,
});
Idempotency
Use idempotency keys at the API layer where supported.