summaryrefslogtreecommitdiff
path: root/src/queue
diff options
context:
space:
mode:
authorAya Morisawa <AyaMorisawa4869@gmail.com>2019-02-04 16:41:53 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2019-02-04 16:41:53 +0900
commit6cd41f98609769c067662c130f6340caca7938b8 (patch)
tree2da77a4f433d23892bc432a5bb143df704601a0a /src/queue
parentUpdate __MISSKEY_HEAD (diff)
downloadsharkey-6cd41f98609769c067662c130f6340caca7938b8.tar.gz
sharkey-6cd41f98609769c067662c130f6340caca7938b8.tar.bz2
sharkey-6cd41f98609769c067662c130f6340caca7938b8.zip
Initialize queue only if queue is enabled (#4125)
Diffstat (limited to 'src/queue')
-rw-r--r--src/queue/index.ts32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/queue/index.ts b/src/queue/index.ts
index d1237435be..65c52d864c 100644
--- a/src/queue/index.ts
+++ b/src/queue/index.ts
@@ -7,19 +7,27 @@ import { program } from '../argv';
const enableQueue = config.redis != null && !program.disableQueue;
-const queue = new Queue('misskey', {
- redis: {
- port: config.redis.port,
- host: config.redis.host,
- password: config.redis.pass
- },
+const queue = initializeQueue();
- removeOnSuccess: true,
- removeOnFailure: true,
- getEvents: false,
- sendEvents: false,
- storeJobs: false
-});
+function initializeQueue() {
+ if (enableQueue) {
+ return new Queue('misskey', {
+ redis: {
+ port: config.redis.port,
+ host: config.redis.host,
+ password: config.redis.pass
+ },
+
+ removeOnSuccess: true,
+ removeOnFailure: true,
+ getEvents: false,
+ sendEvents: false,
+ storeJobs: false
+ });
+ } else {
+ return null;
+ }
+}
export function createHttpJob(data: any) {
if (enableQueue) {