Worker
Worker /
Type parameters
▪ P: object
specifies the Type of the Job-Payload.
Hierarchy
- Worker
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
+ new Worker(name
: string, executer
: function, options
: WorkerOptions‹P
›): Worker
Defined in Worker.ts:29
typeparam
specifies the type of the job-payload.
Parameters:
▪ name: string
of worker
▪ executer: function
function to run jobs
▸ (payload
: P
): Promise<any>
Parameters:
Name | Type |
---|---|
payload | P |
▪Default value
options: WorkerOptions‹P
›= {}
to configure worker
Returns: Worker
Properties
concurrency
• concurrency: number
Defined in Worker.ts:21
name
• name: string
Defined in Worker.ts:20
Accessors
availableExecuters
• get availableExecuters(): number
Defined in Worker.ts:68
Returns: number
amount of available Executers for current worker
isBusy
• get isBusy(): boolean
Defined in Worker.ts:62
Returns: boolean
true if worker runs max concurrent amout of jobs
Methods
decreaseExecutionCount
▸ decreaseExecutionCount(): void
Defined in Worker.ts:123
Returns: void
execute
▸ execute(rawJob
: RawJob): CancellablePromise‹any›
Defined in Worker.ts:75
This method should not be invoked manually and is used by the queue to execute jobs
Parameters:
Name | Type |
---|---|
rawJob | RawJob |
Returns: CancellablePromise‹any›
triggerCompletion
▸ triggerCompletion(job
: Job‹P
›): void
Defined in Worker.ts:120
Parameters:
Name | Type |
---|---|
job | Job‹P › |
Returns: void
triggerFailure
▸ triggerFailure(job
: Job‹P
›, error
: Error
): void
Defined in Worker.ts:117
Parameters:
Name | Type |
---|---|
job | Job‹P › |
error | Error |
Returns: void
triggerSuccess
▸ triggerSuccess(job
: Job‹P
›): void
Defined in Worker.ts:114
Parameters:
Name | Type |
---|---|
job | Job‹P › |
Returns: void