API reference@evolu/commonSchedule › exponential

function exponential(
  base: Duration,
  factor?: number,
): Schedule<
  number &
    Brand<"Int"> &
    Brand<"NonNegative"> &
    Brand<"LessThan281474976710655"> &
    Brand<"Millis">
>;

Defined in: packages/common/src/Schedule.ts:239

Exponential backoff schedule.

Computes delay as base * factor^(attempt - 1):

  • Attempt 1: base
  • Attempt 2: base * factor
  • Attempt 3: base * factor²
  • ...

Never stops — combine with take or maxElapsed to limit.

Example

// 100ms, 200ms, 400ms, 800ms, ...
const exp = exponential("100ms");

// 100ms, 150ms, 225ms, 338ms, ... (gentler growth)
const gentle = exponential("100ms", 1.5);