API reference@evolu/common › Schedule

Composable scheduling strategies.

Composition

NameDescription
ScheduleStepBase interface for schedule-based task helpers.
intersectSchedulesCombines two schedules with AND semantics.
sequenceSchedulesSequences schedules: runs each until it stops, then continues with the next.
unionSchedulesCombines two schedules with OR semantics.
whenInputSelects between two schedules based on input.

Constructors

NameDescription
elapsedA schedule that outputs the total elapsed time since the schedule started.
foreverA schedule that never stops and has no delay.
onceA schedule that runs exactly once with no delay.
alwaysA schedule that always outputs a constant value.
duringA schedule that runs for a specified duration then stops.
exponentialExponential backoff schedule.
fibonacciFibonacci backoff schedule.
fixedFixed interval schedule aligned to time windows.
fromDelayA schedule that runs once with a single delay.
fromDelaysA schedule that runs through a sequence of delays.
linearLinear backoff schedule.
passthroughCreates a schedule that outputs its input, or wraps an existing schedule to output input instead of the original output.
recursA schedule that recurs a fixed number of times.
spacedConstant delay schedule.
unfoldScheduleCreates a schedule by unfolding a state.
windowedDivides the timeline into fixed windows and sleeps until the next boundary.

Limiting

FunctionDescription
maxDelayCaps the delay to a maximum value.
maxElapsedLimits schedule execution to a maximum elapsed time.
takeLimits a schedule to a maximum number of attempts.

Delay

FunctionDescription
addDelayAdds a fixed delay to the schedule's existing delay.
compensateAdjusts delay by subtracting execution time.
delayedAdds an initial delay before the first attempt.
jitterAdds randomized jitter to delays.
modifyDelayTransforms the delay of a schedule.

Filtering

FunctionDescription
untilScheduleInputContinues until the input satisfies a predicate.
untilScheduleOutputContinues until the output satisfies a predicate.
whileScheduleInputContinues while the input satisfies a predicate.
whileScheduleOutputContinues while the output satisfies a predicate.

State

FunctionDescription
resetScheduleAfterResets the schedule after a period of inactivity.

Transform

FunctionDescription
delaysOutputs the delay between recurrences.
foldScheduleFolds over the outputs of a schedule, accumulating state.
mapScheduleTransforms the output of a schedule.
passthroughCreates a schedule that outputs its input, or wraps an existing schedule to output input instead of the original output.
repetitionsWraps a schedule to output the number of repetitions instead of original output.

Collection

FunctionDescription
collectAllScheduleOutputsCollects all outputs into an array.
collectScheduleInputsCollects all inputs into an array.
collectUntilScheduleOutputCollects outputs until a predicate becomes true.
collectWhileScheduleOutputCollects outputs while a predicate is true.

Side effects

FunctionDescription
tapScheduleInputExecutes a side effect for every input without altering the schedule.
tapScheduleOutputExecutes a side effect for every output without altering the schedule.

Retry Strategies

VariableDescription
retryStrategyAwsAWS standard retry strategy.

Type Aliases

Type AliasDescription
ScheduleComposable scheduling strategies for retry, repeat, rate limiting, and more.
ScheduleDepsDependencies provided to a Schedule.