Constructor
new Worker(opts)
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts |
Object | Options for the worker.
Properties
|
Methods
(static) create(opts) → {Worker}
Factory method for creating new workers. This method exists to make it
easier to unit test other modules that need to instantiate new workers.
Parameters:
Name | Type | Description |
---|---|---|
opts |
Object | Options for the Worker. |
Returns:
New Worker.
- Type
- Worker
run() → {Promise}
Runs the worker. If the task for the job fails, then this method will retry
the task (with an exponential backoff) as set by the environment.
Returns:
Promise that is resolved once the task succeeds or
fails.
- Type
- Promise