Skip to content

Commit

Permalink
better multi-master maintenance queue mgmt
Browse files Browse the repository at this point in the history
  • Loading branch information
timgit committed Mar 28, 2020
1 parent 11dffb8 commit efee899
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/boss.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,13 @@ class Boss extends EventEmitter {

async supervise () {
await this.config.manager.deleteQueue(plans.completedJobPrefix + queues.MAINTENANCE)
await this.config.manager.deleteQueue(queues.MAINTENANCE)

await this.maintenanceAsync()

await this.config.manager.subscribe(queues.MAINTENANCE, { batchSize: 10 }, (jobs) => this.onMaintenance(jobs))

if (this.monitorStates) {
await this.config.manager.deleteQueue(plans.completedJobPrefix + queues.MONITOR_STATES)
await this.config.manager.deleteQueue(queues.MONITOR_STATES)

await this.monitorStatesAsync()

Expand All @@ -70,6 +68,7 @@ class Boss extends EventEmitter {
keepUntilSeconds: this.maintenanceIntervalSeconds * 2
}

await this.config.manager.deleteQueue(queues.MAINTENANCE)
await this.config.manager.publish(queues.MAINTENANCE, null, options)
}

Expand All @@ -79,6 +78,7 @@ class Boss extends EventEmitter {
keepUntilSeconds: this.monitorIntervalSeconds * 2
}

await this.config.manager.deleteQueue(queues.MONITOR_STATES)
await this.config.manager.publish(queues.MONITOR_STATES, null, options)
}

Expand Down

0 comments on commit efee899

Please sign in to comment.