diff --git a/packages/controller-utils/src/create-service-policy.ts b/packages/controller-utils/src/create-service-policy.ts index 094698abcc..210516d124 100644 --- a/packages/controller-utils/src/create-service-policy.ts +++ b/packages/controller-utils/src/create-service-policy.ts @@ -91,12 +91,18 @@ export const DEFAULT_DEGRADED_THRESHOLD = 5_000; * ``` ts * class Service { * constructor() { - * this.#policy = createServicePolicy(); + * this.#policy = createServicePolicy({ + * maxRetries: 3, + * maxConsecutiveFailures: 3, + * circuitBreakDuration: 5000, + * degradedThreshold: 2000, + * }); * } * * async fetch() { - * this.#policy.execute(async () => { - * // ... + * return await this.#policy.execute(async () => { + * const response = await fetch('https://some/url'); + * return await response.json(); * }); * } * }