TaskLoopOptions
Hierarchy
- TaskLoopPredicates
- TaskLoopOptions
Index
Properties
optionalinheritedisFinishedFunction
A function that is called only when there are no tasks to be processed.
If it resolves to true then the run finishes. Being called only
when there are no tasks being processed means that as long as isTaskReadyFunction()
keeps resolving to true, isFinishedFunction() will never be called.
Type declaration
Returns Promise<boolean>
optionalinheritedisTaskReadyFunction
A function that indicates whether runTaskFunction should be called.
This function is called every time there is free capacity for a new task and it should
indicate whether it should start a new task or not by resolving to either true or false.
Besides its obvious use, it is also useful for task throttling to save resources.
Type declaration
Returns Promise<boolean>
optionalmaybeRunIntervalSecs
How often the pool should check if a new task is ready, in seconds.
The two predicates that steer a task loop: is there work ready? and are we done? These are the parts of the loop a caller legitimately overrides, as opposed to the task itself (
runTaskFunction), which the loop's driver owns.