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

Function delays

packages/effect/src/internal/schedule.ts:611–631  ·  view source on GitHub ↗
(
  self: Schedule.Schedule<Out, In, R>
)

Source from the content-addressed store, hash-verified

609
610/** @internal */
611export const delays = <Out, In, R>(
612 self: Schedule.Schedule<Out, In, R>
613): Schedule.Schedule<Duration.Duration, In, R> =>
614 makeWithState(self.initial, (now, input, state) =>
615 pipe(
616 self.step(now, input, state),
617 core.flatMap((
618 [state, _, decision]
619 ): Effect.Effect<[any, Duration.Duration, ScheduleDecision.ScheduleDecision]> => {
620 if (ScheduleDecision.isDone(decision)) {
621 return core.succeed([state, Duration.zero, decision])
622 }
623 return core.succeed(
624 [
625 state,
626 Duration.millis(Intervals.start(decision.intervals) - now),
627 decision
628 ]
629 )
630 })
631 ))
632
633/** @internal */
634export const mapBoth = dual<

Callers

nothing calls this directly

Calls 4

makeWithStateFunction · 0.85
startMethod · 0.80
pipeFunction · 0.70
stepMethod · 0.65

Tested by

no test coverage detected