Defines in seconds how often the pool should attempt to adjust the desired concurrency based on the latest system status. Setting it lower than 1 might have a severe impact on performance. We suggest using a value from 5 to 20.
The desired number of tasks that should be running parallel on the start of the pool,
if there is a large enough supply of them.
By default, it is
Minimum level of desired concurrency to reach before more scaling up is allowed.
A function that is called only when there are no tasks to be processed. If it resolves to
truethen the pool’s run finishes. Being called only when there are no tasks being processed means that as long as
isTaskReadyFunction()keeps resolving to
isFinishedFunction()will never be called. To abort a run, use the AutoscaledPool.abort method.
A function that indicates whether
runTaskFunctionshould 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
false. Besides its obvious use, it is also useful for task throttling to save resources.
Specifies a period in which the instance logs its state, in seconds.
null to disable periodic logging.
The maximum number of tasks running in parallel.
The maximum number of tasks per minute the pool can run.
By default, this is set to
Infinity, but you can pass any positive, non-zero integer.
Indicates how often the pool should call the
runTaskFunction() to start a new task, in seconds.
This has no effect on starting new tasks immediately after a task completes.
The minimum number of tasks running in parallel.
WARNING: If you set this value too high with respect to the available system memory and CPU, your code might run extremely slow or crash. If you’re not sure, just keep the default value and the concurrency will scale up automatically.
A function that performs an asynchronous resource-intensive task. The function must either be labeled
asyncor return a promise.
Defines the amount of desired concurrency to be subtracted with each scaling down. The minimum scaling step is one.
Defines the fractional amount of desired concurrency to be added with each scaling up. The minimum scaling step is one.
Timeout in which the
runTaskFunction needs to finish, given in seconds.