Преглед изворни кода

Graceful job queue shutdown

tags/v1.0.0-beta.10.pre.3
Chocobozzz пре 4 година
родитељ
комит
14f2b3ad11
No known key found for this signature in database GPG Key ID: 583A612D890159BE
2 измењених фајлова са 13 додато и 0 уклоњено
  1. +6
    -0
      server.ts
  2. +7
    -0
      server/lib/job-queue/job-queue.ts

+ 6
- 0
server.ts Прегледај датотеку

@@ -195,4 +195,10 @@ async function startApplication () {
logger.info('Server listening on %s:%d', hostname, port)
logger.info('Web server: %s', CONFIG.WEBSERVER.URL)
})

process.on('exit', () => {
JobQueue.Instance.terminate()
})

process.on('SIGINT', () => process.exit(0))
}

+ 7
- 0
server/lib/job-queue/job-queue.ts Прегледај датотеку

@@ -83,6 +83,13 @@ class JobQueue {
}
}

terminate () {
for (const queueName of Object.keys(this.queues)) {
const queue = this.queues[queueName]
queue.close()
}
}

createJob (obj: CreateJobArgument) {
const queue = this.queues[obj.type]
if (queue === undefined) {


Loading…
Откажи
Сачувај