new Schedulers.Base(options, instances)
Create an instance
| Name | Type | Description |
|---|---|---|
options |
object |
The options passed in to the instance |
instances |
array |
Already running worker instances |
Methods
-
_do(event, data, callback)
schedulers/base.js, line 79 -
The actual method that picks a worker to send work to
Name Type Description eventstring The name of the event to send.
dataWhatever stringifyable value that is to be sent with the event.
callbackfunction The callback to be called when the event completes.
-
callInstance(instanceOrIndex, event, data, callback)
schedulers/base.js, line 60 -
Sends the specified worker an event to process.
Name Type Description instanceOrIndexEither the index of a worker or the actual worker to send event to.
eventstring The name of the event to send.
dataWhatever stringifyable value that is to be sent with the event.
callbackfunction The callback to be called when the event completes.
-
checkAvailableInstances(event)
schedulers/base.js, line 29 -
Check that there is a worker available to perform work. Throws an error if there are no workers.
Name Type Description eventstring Name of the event to be dispatched, used for error message.
-
deregister(instance)
schedulers/base.js, line 45 -
Deregisters an instance from the avialable worker instances.
Name Type Description instanceobject The worker instance to remove.
-
do(event, data, callback)
schedulers/base.js, line 96 -
Used to select a worker and send work to it. Internally it uses _do and checkAvailableInstances to perform the worker selection and delegation.
Name Type Description eventstring The name of the event to send.
dataWhatever stringifyable value that is to be sent with the event.
callbackfunction The callback to be called when the event completes.
-
kill(signal)
schedulers/base.js, line 86 -
Kills a worker
Name Type Default Description signalstring SIGTERM What kill signal to send to the worker
-
register(instance)
schedulers/base.js, line 38 -
Registers a worker with the scheduler
Name Type Description instanceobject The instance to register.