(options: Effect.Retry.Options<any>)
| 2015 | |
| 2016 | /** @internal */ |
| 2017 | export 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 */ |
| 2043 | export const retryOrElse_Effect = dual< |
no test coverage detected