@jiminp/tooltool
    Preparing search index...

    Function createExponentialBackoffDelay

    • Creates an exponential backoff delay function for use with retryWithDelay.

      Parameters

      Returns DelayFunctionWithForfeit

      A boolean-returning delay: true after waiting, false on forfeiture.

      Delays have no jitter or cancellation. The returned delay rejects with RangeError if its computed wait is not finite; a finite max_delay can cap exponential growth. Finite nonpositive delays still yield asynchronously, and sleep splits large finite delays into safe timer chunks. Factory-based retries conservatively infer T | null, even without an attempt limit.

      const delay = createExponentialBackoffDelay({ init_delay: 100, max_attempts: 5 });
      await retryWithDelay(fetchData, delay);