( base: Duration.Input, factor: number = 2 )
| 889 | * @since 2.0.0 |
| 890 | */ |
| 891 | export const exponential = ( |
| 892 | base: Duration.Input, |
| 893 | factor: number = 2 |
| 894 | ): Schedule<Duration.Duration> => { |
| 895 | const baseMillis = Duration.toMillis(Duration.fromInputUnsafe(base)) |
| 896 | return fromStepWithMetadata(effect.succeed((meta) => { |
| 897 | const duration = Duration.millis(baseMillis * Math.pow(factor, meta.attempt - 1)) |
| 898 | return effect.succeed([duration, duration]) |
| 899 | })) |
| 900 | } |
| 901 | |
| 902 | /** |
| 903 | * Schedule that always recurs, increasing delays by summing the preceding |
nothing calls this directly
no test coverage detected