@jiminp/tooltool
    Preparing search index...

    Function retryWithDelay

    • Retries an async function until it succeeds, using a delay function between attempts.

      Type Parameters

      • T

        The resolved return type.

      Parameters

      • f: Retryable<T>

        The function to retry.

      • doDelay: DelayFunction

        Called after each failure. If it returns false, retries stop and null is returned.

      Returns Promise<T>

      The result of f, or null if retries were forfeited.

      const result = await retryWithDelay(
      () => fetchData(),
      createExponentialBackoffDelay({ init_delay: 100, max_attempts: 3 }),
      );
    • Retries an async function until it succeeds, using a delay function between attempts.

      Type Parameters

      • T

        The resolved return type.

      Parameters

      Returns Promise<T | null>

      The result of f, or null if retries were forfeited.

      const result = await retryWithDelay(
      () => fetchData(),
      createExponentialBackoffDelay({ init_delay: 100, max_attempts: 3 }),
      );