diff options
-rw-r--r-- | server.ts | 6 | ||||
-rw-r--r-- | server/lib/job-queue/job-queue.ts | 7 |
2 files changed, 13 insertions, 0 deletions
@@ -195,4 +195,10 @@ async function startApplication () { | |||
195 | logger.info('Server listening on %s:%d', hostname, port) | 195 | logger.info('Server listening on %s:%d', hostname, port) |
196 | logger.info('Web server: %s', CONFIG.WEBSERVER.URL) | 196 | logger.info('Web server: %s', CONFIG.WEBSERVER.URL) |
197 | }) | 197 | }) |
198 | |||
199 | process.on('exit', () => { | ||
200 | JobQueue.Instance.terminate() | ||
201 | }) | ||
202 | |||
203 | process.on('SIGINT', () => process.exit(0)) | ||
198 | } | 204 | } |
diff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.ts index b018d0e8a..157c57ba9 100644 --- a/server/lib/job-queue/job-queue.ts +++ b/server/lib/job-queue/job-queue.ts | |||
@@ -83,6 +83,13 @@ class JobQueue { | |||
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
86 | terminate () { | ||
87 | for (const queueName of Object.keys(this.queues)) { | ||
88 | const queue = this.queues[queueName] | ||
89 | queue.close() | ||
90 | } | ||
91 | } | ||
92 | |||
86 | createJob (obj: CreateJobArgument) { | 93 | createJob (obj: CreateJobArgument) { |
87 | const queue = this.queues[obj.type] | 94 | const queue = this.queues[obj.type] |
88 | if (queue === undefined) { | 95 | if (queue === undefined) { |