Documentation / @andrew_l/app / WorkerInstance
Interface: WorkerInstance<C>
Runtime state of a worker instance. Extends AppInstance with task queue and pool. Managed with the standard startApp / stopApp / shutdownApp lifecycle.
Type Parameters
C
C extends WorkerStrategy = WorkerStrategy
Properties
definition
definition:
WorkerDefinition<{ }, { }, { },C>
executeStrategy
executeStrategy:
C|null
isIdle
readonlyisIdle:boolean
Returns true when worker do nothing
isOverloaded
readonlyisOverloaded:boolean
Check if the worker is overloaded (e.g., queue length is high)
log
log:
Logger
overloadedSignaled
overloadedSignaled:
boolean
pool
pool:
ResourcePool<symbol>
queue
queue:
AsyncIterableQueue<TaskContext<C>>
queueMaxSize
readonlyqueueMaxSize:number
queueSize
readonlyqueueSize:number
Tasks queue size
runTask
runTask:
CancellablePromise<void> |null
taskParallel
readonlytaskParallel:number
Methods
addTask()
addTask(
ctx):void
Add task into execution queue
Parameters
ctx
TaskContext<C>
Returns
void