(options: Effect.Retry.Options<any>)
| 2023 | |
| 2024 | /** @internal */ |
| 2025 | export const fromRetryOptions = (options: Effect.Retry.Options<any>): Schedule.Schedule<any, any, any> => { |
| 2026 | const base = options.schedule ?? forever |
| 2027 | const withWhile = options.while ? |
| 2028 | whileInputEffect(base, (e) => { |
| 2029 | const applied = options.while!(e) |
| 2030 | if (typeof applied === "boolean") { |
| 2031 | return core.succeed(applied) |
| 2032 | } |
| 2033 | return scheduleDefectWrap(applied) |
| 2034 | }) : |
| 2035 | base |
| 2036 | const withUntil = options.until ? |
| 2037 | untilInputEffect(withWhile, (e) => { |
| 2038 | const applied = options.until!(e) |
| 2039 | if (typeof applied === "boolean") { |
| 2040 | return core.succeed(applied) |
| 2041 | } |
| 2042 | return scheduleDefectWrap(applied) |
| 2043 | }) : |
| 2044 | withWhile |
| 2045 | return options.times !== undefined ? |
| 2046 | intersect(withUntil, recurs(options.times)) : |
| 2047 | withUntil |
| 2048 | } |
| 2049 | |
| 2050 | /** @internal */ |
| 2051 | export const retryOrElse_Effect = dual< |
no test coverage detected