ScalingEffectJob<'r, 's, 'err> Type
A background service that runs an effect over and over in a baseline worker, and in extra workers added and removed
according to GetWorkload, which is checked every monitorInterval, 10 seconds by default. At most
maxExtraWorkers are added, 10 by default.
The service keeps its workers running, but leaves how each run behaves to the effect. When a run fails or throws,
the error is logged, and the worker waits before running the effect again, from restartDelay, 1 second by
default, doubling with each failure in a row, up to maxRestartDelay, 1 minute by default. Retrying, backing
off when there is nothing to do, and logging errors in a way that suits the work, belong in the effect, composed
with the functions of Orsak.Resilience.
work is called once for each worker, and its effect is run by that worker until it stops.
Compose the effect inside work, so each worker gets its own state, such as the backoff of
Effect.addDelay:
fun queue -> handleNext queue |> Effect.addDelayWithMax_ 1.<s> 10.<s>
ICancellationProvider.
Constructors
| Constructor |
Description
|
Full Usage:
ScalingEffectJob(name, logger, state, work, runnerFactory, ?maxExtraWorkers, ?monitorInterval, ?restartDelay, ?maxRestartDelay)
Parameters:
string
logger : ILogger
state : 's
work : 's -> Effect<'r, unit, 'err>
runnerFactory : CancellationToken -> 'r
?maxExtraWorkers : int
?monitorInterval : TimeSpan
?restartDelay : TimeSpan
?maxRestartDelay : TimeSpan
Returns: ScalingEffectJob<'r, 's, 'err>
|
|
Instance members
| Instance member |
Description
|
Full Usage:
this.GetWorkload
Parameters:
CancellationToken
Returns: Task<WorkerLoad>
Modifiers: abstract |
How much work the job has, checked every
|
Orsak