Skip to content

Configuration

Options

name
Required:false
Type:string
Default:Runner-<count>
  • A unique name to identify the runner instance
concurrency
Required:false
Type:number
Default:3
  • Sets the concurrency of the runner
  • Concurrency should be a positive integer, or -1
  • Setting concurrency as -1 would run all tasks at once
  • If concurrency is not bound, throws a RangeError

Hooks

onStart
Required:false
Type:function
Default:undefined
  • Fired whenever the runner goes from idle/paused to working state
Signature
OnStart<T = any> = ({
tasks,
count,
duration,
}: {
tasks: TasksList<T>;
count: TasksCount;
duration: RunnerDuration
}) => void;
onPause
Required:false
Type:function
Default:undefined
  • Fired whenever the runner goes from working to paused state
Signature
OnPause<T = any> = ({
tasks,
count,
duration,
}: {
tasks: TasksList<T>;
count: TasksCount;
duration: RunnerDuration
}) => void;
onDestroy
Required:false
Type:function
Default:undefined
  • Fired whenever the runner is destroyed
Signature
OnDestroy<T = any> = ({
tasks,
count,
duration,
}: {
tasks: TasksList<T>;
count: TasksCount;
duration: RunnerDuration
}) => void;
onAdd
Required:false
Type:function
Default:undefined
  • Fired every time a task/tasks are added to the queue
Signature
OnAdd<T = any> = ({
tasks,
count,
duration,
method,
}: {
tasks: TasksList<T>;
count: TasksCount;
duration: RunnerDuration;
method: AdditionMethods;
}) => void;
onRun
Required:false
Type:function
Default:undefined
  • Fired every time a task is picked up for execution
Signature
OnRun<T = any> = ({
tasks,
count,
duration,
task,
}: {
tasks: TasksList<T>;
count: TasksCount;
duration: RunnerDuration;
task: Task<T>;
}) => void;
onDone
Required:false
Type:function
Default:undefined
  • Fired after every task’s completion
Signature
OnDone<T = any> = ({
tasks,
count,
duration,
task,
result,
}: {
tasks: TasksList<T>;
count: TasksCount;
duration: RunnerDuration;
task: Task<T>;
result?: T;
}) => void;
onRemove
Required:false
Type:function
Default:undefined
  • Fired every time a task/tasks are removed from the queue
Signature
OnRemove<T = any> = ({
tasks,
count,
duration,
method,
removedTasks,
}: {
tasks: TasksList<T>;
count: TasksCount;
duration: RunnerDuration;
method: RemovalMethods;
removedTasks: Task<T>[];
}) => void;
onEnd
Required:false
Type:function
Default:undefined
  • Fired whenever the runner goes from working to idle state
Signature
OnEnd<T = any> = ({
tasks,
count,
duration,
}: {
tasks: TasksList<T>;
count: TasksCount;
duration: RunnerDuration;
}) => void;