MCPcopy Create free account
hub / github.com/Effect-TS/effect / exponential

Function exponential

packages/effect/src/Schedule.ts:891–900  ·  view source on GitHub ↗
(
  base: Duration.Input,
  factor: number = 2
)

Source from the content-addressed store, hash-verified

889 * @since 2.0.0
890 */
891export const exponential = (
892 base: Duration.Input,
893 factor: number = 2
894): Schedule<Duration.Duration> => {
895 const baseMillis = Duration.toMillis(Duration.fromInputUnsafe(base))
896 return fromStepWithMetadata(effect.succeed((meta) => {
897 const duration = Duration.millis(baseMillis * Math.pow(factor, meta.attempt - 1))
898 return effect.succeed([duration, duration])
899 }))
900}
901
902/**
903 * Schedule that always recurs, increasing delays by summing the preceding

Callers

nothing calls this directly

Calls 2

fromStepWithMetadataFunction · 0.85
succeedMethod · 0.45

Tested by

no test coverage detected