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

Function retryLoop

packages/effect/src/internal/layer.ts:890–905  ·  view source on GitHub ↗
(
  self: Layer.Layer<ROut, E, RIn>,
  schedule: Schedule.Schedule<X, E, RIn2>,
  stateTag: Context.Tag<{ state: unknown }, { state: unknown }>,
  state: unknown
)

Source from the content-addressed store, hash-verified

888 }))
889
890const retryLoop = <ROut, E, RIn, X, RIn2>(
891 self: Layer.Layer<ROut, E, RIn>,
892 schedule: Schedule.Schedule<X, E, RIn2>,
893 stateTag: Context.Tag<{ state: unknown }, { state: unknown }>,
894 state: unknown
895): Layer.Layer<ROut, E, RIn | RIn2> => {
896 return pipe(
897 self,
898 catchAll((error) =>
899 pipe(
900 retryUpdate(schedule, stateTag, error, state),
901 flatMap((env) => fresh(retryLoop(self, schedule, stateTag, pipe(env, Context.get(stateTag)).state)))
902 )
903 )
904 )
905}
906
907const retryUpdate = <X, E, RIn>(
908 schedule: Schedule.Schedule<X, E, RIn>,

Callers 1

layer.tsFile · 0.85

Calls 4

retryUpdateFunction · 0.85
freshFunction · 0.85
pipeFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected