API reference@evolu/commonSchedule › maxDelay

function maxDelay(
  max: Duration,
): <Output, Input>(
  schedule: Schedule<Output, Input>,
) => Schedule<Output, Input>;

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

Caps the delay to a maximum value.

If the schedule returns a delay greater than max, returns max instead.

Example

// Exponential capped at 10 seconds
const capped = maxDelay("10s")(exponential("1s"));
// 1s, 2s, 4s, 8s, 10s, 10s, 10s, ...