API reference@evolu/commonSchedule › take

function take(
  n: number,
): <Output, Input>(
  schedule: Schedule<Output, Input>,
) => Schedule<Output, Input>;

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

Limits a schedule to a maximum number of attempts.

After n attempts, returns Err(Done<void>) (stop).

Example

// Exponential backoff, max 3 retries
const limited = take(3)(exponential("100ms"));
// Attempt 1: 100ms, Attempt 2: 200ms, Attempt 3: 400ms, Attempt 4: Err(Done<void>)