Skip to content
Snippets Groups Projects
Unverified Commit 14f2b3ad authored by Chocobozzz's avatar Chocobozzz
Browse files

Graceful job queue shutdown

parent 8e0fd45e
No related branches found
No related tags found
No related merge requests found
...@@ -195,4 +195,10 @@ async function startApplication () { ...@@ -195,4 +195,10 @@ async function startApplication () {
logger.info('Server listening on %s:%d', hostname, port) logger.info('Server listening on %s:%d', hostname, port)
logger.info('Web server: %s', CONFIG.WEBSERVER.URL) logger.info('Web server: %s', CONFIG.WEBSERVER.URL)
}) })
process.on('exit', () => {
JobQueue.Instance.terminate()
})
process.on('SIGINT', () => process.exit(0))
} }
...@@ -83,6 +83,13 @@ class JobQueue { ...@@ -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) { createJob (obj: CreateJobArgument) {
const queue = this.queues[obj.type] const queue = this.queues[obj.type]
if (queue === undefined) { if (queue === undefined) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment