Effect Module
Resilience functions for effects: retrying with backoff, logging errors, and running effects perpetually.
Functions and values
| Function or value |
Description
|
Full Usage:
addDelay baseDelay effect
Parameters:
float<MeasureProduct<s, MeasureOne>>
-
effect : Effect<'a, bool, 'b>
-
Returns: Effect<'a, bool, 'b>
Type parameters: 'a, 'b |
Takes a base delay and an effect, and returns an effect with a delay added at the end, if the provided effect returned false. If the effect is re-run, the delay is increased each time the original effect returns false. If the effect returns true, no delay is added, and the calculated delay is reset to 0.
|
Full Usage:
addDelayOnError baseDelay effect
Parameters:
float<MeasureProduct<s, MeasureOne>>
-
effect : Effect<'a, 'a0, 'e>
-
Returns: Effect<'a, 'a0, 'e>
Type parameters: 'a, 'a, 'e |
Takes a base delay and an effect, and returns an effect with a delay added at the end, if the provided effect returned with an error. If the effect is re-run, the delay is increased each time the original effect returns an error. If the effect returns Ok, no delay is added, and the calculated delay is reset to 0.
|
Full Usage:
addDelayOnErrorWithMax baseDelay maxDelay effect
Parameters:
float<MeasureProduct<s, MeasureOne>>
-
maxDelay : float<MeasureProduct<s, MeasureOne>>
-
effect : Effect<'a, 'a0, 'e>
-
Returns: Effect<'a, 'a0, 'e>
Type parameters: 'a, 'a, 'e |
Takes a base delay and an effect, and returns an effect with a delay added at the end, if the provided effect returned with an error. If the effect is re-run, the delay is increased each time the original effect returns an error. If the effect returns Ok, no delay is added, and the calculated delay is reset to 0.
|
Full Usage:
addDelayWithMax baseDelay maxDelay effect
Parameters:
float<MeasureProduct<s, MeasureOne>>
-
maxDelay : float<MeasureProduct<s, MeasureOne>>
-
effect : Effect<'a, bool, 'b>
-
Returns: Effect<'a, bool, 'b>
Type parameters: 'a, 'b |
Takes a base delay and en effect, and returns an effect with a delay added at the end, if the provided effect returned false. If the effect is re-run, the delay is increased each time the original effect returns false. If the effect returns true, no delay is added, and the calculated delay is reset to 0. The delay till will not be longer than maxDelay
|
Full Usage:
addDelayWithMax_ baseDelay maxDelay effect
Parameters:
float<MeasureProduct<s, MeasureOne>>
-
maxDelay : float<MeasureProduct<s, MeasureOne>>
-
effect : Effect<'a, bool, 'b>
-
Returns: Effect<'a, unit, 'b>
Type parameters: 'a, 'b |
Takes a base delay and an effect, and returns an effect with a delay added at the end, if the provided effect returned false. If the effect is re-run, the delay is increased each time the original effect returns false. If the effect returns true, no delay is added, and the calculated delay is reset to 0. The delay till will not be longer than maxDelay Then the bool is discarded and unit is returned.
|
Full Usage:
addDelay_ baseDelay effect
Parameters:
float<MeasureProduct<s, MeasureOne>>
-
effect : Effect<'a, bool, 'b>
-
Returns: Effect<'a, unit, 'b>
Type parameters: 'a, 'b |
Takes a base delay and an effect, and returns an effect with a delay added at the end, if the provided effect returned false. If the effect is re-run, the delay is increased each time the original effect returns false. If the effect returns true, no delay is added, and the calculated delay is reset to 0. Then the bool is discarded and unit is returned.
|
Full Usage:
logError log effect
Parameters:
ILoggerFactory -> 'e -> unit
-
Logs an error, given the environment's logger factory
effect : Effect<'a, 'a0, 'e>
-
The effect
Returns: Effect<'a, 'a0, 'e>
Type parameters: 'e, 'a, 'a (requires :> Microsoft.Extensions.Logging.ILoggerFactory) |
Logs the error when the effect fails, with log, and then fails with the same error. The environment has to be an ILoggerFactory.
Example
|
Full Usage:
repeatUntilCancellation token effect
Parameters:
CancellationToken
-
effect : Effect<'a, unit, 'b>
-
Returns: Effect<'a, Never, 'b>
Type parameters: 'a, 'b |
Re-runs the provided effect until the provided token signals cancellation. If the provided effect fails, it returns with an error.
|
|
|
|
Orsak