new Coordinator(db, options)
lib/Coordinator.js, line 32
Create a coordinator using the given mongodb driver connection.
If you're using mongoose, you can access it with mongoose.db.
| Name | Type | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
db |
Object | |||||||||
options |
Object |
optional
|
Extends
- EventEmitter
Members
-
dbObject
-
Methods
-
schedule(options, fn){Task}
lib/Coordinator.js, line 84 -
Schedule a task to run at a fixed interval. The interval may be represented as a string, see time
Name Type Description optionsObject Name Type Default Description namestring task name. Only one instance of this task will run at a time
intervalnumber | string timer interval (in ms) to repeat the task
offsetnumber | string 0 optional offset from whole intervals to run this task
timeoutnumber | string interval optional lock expire time. Set to 0 to disable timeout
fnCoordinator~runTask Returns:
Type Description Task
Type Definitions
-
runTask(done)
lib/Coordinator.js, line 62 -
Task implementation
Name Type Description doneCoordinator~taskDone -
taskDone()
lib/Coordinator.js, line 68 -
Tell the coordinator the task has completed