jira.js
    Preparing search index...

    Function withRetry

    • Wraps an async operation with automatic retry on failures worth retrying.

      Retries a transient transport failure and a 502/503/504 gateway error — the same policy the client applies to its own requests, so wrapping a call does not change which failures count as temporary. Everything else is rethrown on the first attempt: 401, 403, 404 and 500 describe the request, not the moment. A 429 joins the list only under retryRateLimit, and then honours Retry-After.

      It is therefore a transient-failure helper, not a poller — to wait on eventually-consistent state, loop on the value rather than on a thrown error.

      Type Parameters

      • T

      Parameters

      Returns Promise<T>

        const page = await withRetry(
      () => confluence.page.getPageById({ id: 12345 }),
      { maxAttempts: 4, initialDelayMs: 500 },
      );