MCPcopy
hub / github.com/Effect-TS/effect / delays

Function delays

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

Source from the content-addressed store, hash-verified

601
602/** @internal */
603export const delays = <Out, In, R>(
604 self: Schedule.Schedule<Out, In, R>
605): Schedule.Schedule<Duration.Duration, In, R> =>
606 makeWithState(self.initial, (now, input, state) =>
607 pipe(
608 self.step(now, input, state),
609 core.flatMap((
610 [state, _, decision]
611 ): Effect.Effect<[any, Duration.Duration, ScheduleDecision.ScheduleDecision]> => {
612 if (ScheduleDecision.isDone(decision)) {
613 return core.succeed([state, Duration.zero, decision])
614 }
615 return core.succeed(
616 [
617 state,
618 Duration.millis(Intervals.start(decision.intervals) - now),
619 decision
620 ]
621 )
622 })
623 ))
624
625/** @internal */
626export 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