← Docs
Recipe

Resilience Patterns

Circuit breakers, retries, and graceful degradation for Nimbus licensing infrastructure.

Circuit Breaker

Prevent cascading failures by wrapping external calls in a stateful breaker. Three states: closed, open, half-open. After threshold failures, the breaker opens and fast-fails for a cooldown window.

const breaker = new CircuitBreaker({threshold: 5, cooldownMs: 30000});

Exponential Backoff with Jitter

Avoid thundering herd on license server recovery. Multiply delay by 2 each retry, cap at max, add random jitter ±25%.

delay = Math.min(base * 2 ** attempt, max) * (0.75 + Math.random() * 0.5);

Offline Grace Cache

When KeyAuth is unreachable, fall back to an HMAC-signed local cache. Valid for a configurable grace window. Prevents paying users from being locked out during transient network issues.

Token Bucket Rate Limiter

Smooth bursty traffic to license validation endpoints. Tokens refill at a steady rate. Bucket capacity caps instantaneous bursts. Reject with 429 when empty.

These patterns ship inside the Nimbus C++ loader and the dashboard API layer. For integration details, see License Flow.