UNPKG

@olakai/sdk

Version:

This document demonstrates how to use the Olakai SDK with all its features.

17 lines 792 B
import { Middleware } from "./index"; /** * Create a circuit breaker middleware * This middleware implements a circuit breaker pattern to prevent a function from being called if it fails too many times. * @param options - The options for the middleware * @returns A middleware function * @default options - { * failureThreshold: 5, // Number of failures before the circuit breaker opens * resetTimeoutMs: 30000, // Time in milliseconds before the circuit breaker closes * } * @throws {CircuitBreakerOpenError} if the circuit breaker is OPEN */ export declare function createCircuitBreakerMiddleware<TArgs extends any[], TResult>(options: { failureThreshold: number; resetTimeoutMs: number; }): Middleware<TArgs, TResult>; //# sourceMappingURL=circuitBreaker.d.ts.map