MCPcopy Index your code
hub / github.com/Effect-TS/effect / fromRetryOptions

Function fromRetryOptions

packages/effect/src/internal/schedule.ts:2017–2040  ·  view source on GitHub ↗
(options: Effect.Retry.Options<any>)

Source from the content-addressed store, hash-verified

2015
2016/** @internal */
2017export const fromRetryOptions = (options: Effect.Retry.Options<any>): Schedule.Schedule<any, any, any> => {
2018 const base = options.schedule ?? forever
2019 const withWhile = options.while ?
2020 whileInputEffect(base, (e) => {
2021 const applied = options.while!(e)
2022 if (typeof applied === "boolean") {
2023 return core.succeed(applied)
2024 }
2025 return scheduleDefectWrap(applied)
2026 }) :
2027 base
2028 const withUntil = options.until ?
2029 untilInputEffect(withWhile, (e) => {
2030 const applied = options.until!(e)
2031 if (typeof applied === "boolean") {
2032 return core.succeed(applied)
2033 }
2034 return scheduleDefectWrap(applied)
2035 }) :
2036 withWhile
2037 return options.times !== undefined ?
2038 intersect(withUntil, recurs(options.times)) :
2039 withUntil
2040}
2041
2042/** @internal */
2043export const retryOrElse_Effect = dual<

Callers 1

schedule.tsFile · 0.85

Calls 2

scheduleDefectWrapFunction · 0.85
recursFunction · 0.85

Tested by

no test coverage detected