Optional logMapping: Partial<TaskWorkerLogMapping>Private buildPrivate buildPrivate loggerPrivate stepPrivate tasksPrivate assertPrivate assertStop and delete this task from worker and wait for it to resolved/rejected
Rest ...args: Parameters<WorkerEvents<TI>[E]>Get or initialize task instance and store it in worker
Task uuid or undefined
Task type
Task class
Task props
Common context
return new Task class instance or existing task instance
const task = await worker.getOrInitializeTask(oldTaskUuid, 'type', MyTask, {prop1: 'value1'}, {common: 'context'});
Get task instance by uuid
Task instance or undefined
Get all task instances based on type
Array of task instances
Private handlehandle instance job start
never
Private handlehandle pre-build task description
never
Private handlehandle task reject
true if task should be retried
Private handlehandle task resolve
true if task should be retried
Private handlePrivate handlePrivate handlePrivate handlehandle timed jobs this resets task instance and run it again
never
Private handlenever
method to import tasks back to worker (like from database or other storage)
Initialize and return task class instance and store it in worker
Task class
Task constructor properties
Common context (all tasks shared this context type)
Task class instance
const task = await worker.initializeTask(MyTask, {prop1: 'value1'}, {common: 'context'});
Private logHandle log keys with buildLog
log message as string
Private lookuplookup single type task instance
TaskWorkerInstance<FullTaskInstance<unknown, TI>> | undefined
never
Private notifyPrivate reloadOptional event: EPrivate resetReset task instance values.
start and end datesInitRestart this task instance if it's not in running state
Task instance
if task is already running
if task is not allowed to restart
Private runRun task instance.
Private runhandle task error and possible retries
true if task should be retried
runTask flow and manual handleTaskAbort
Private runrun task flow
true if task should be retried
Private setStart this task instance.
Task instance
Promise that will be resolved when task is started
if task is already started
await worker.startTask(task);
stop currently running task and wait for it to resolved/rejected
Update task instance with new data, this is useful when task is updated from outside (like database events).
Note: this will not directly affect tasks flow directly, just updates task data and status.
updated task data
Wait for this task to be resolved/rejected (also starts task if not started yet)
Task instance
Promise of current task data
if task is not instant
if task is already started
Wait for this task to be resolved/rejected on each run (also starts task if not started yet)
Note: Task will be running and retried even if this Promise is thrown as new Promise will be created for each new run.
Task instance
Promise of single run task data
if task is not instant
if task is already started
if task will be retried and continue to next retry run
Generated using TypeDoc
set logger instance (or change it if already set on constructor)