Initialize queue only if queue is enabled (#4125)

This commit is contained in:
Aya Morisawa 2019-02-04 16:41:53 +09:00 committed by syuilo
parent baf861ac79
commit 6cd41f9860

View file

@ -7,19 +7,27 @@ import { program } from '../argv';
const enableQueue = config.redis != null && !program.disableQueue; const enableQueue = config.redis != null && !program.disableQueue;
const queue = new Queue('misskey', { const queue = initializeQueue();
redis: {
port: config.redis.port,
host: config.redis.host,
password: config.redis.pass
},
removeOnSuccess: true, function initializeQueue() {
removeOnFailure: true, if (enableQueue) {
getEvents: false, return new Queue('misskey', {
sendEvents: false, redis: {
storeJobs: false 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) { export function createHttpJob(data: any) {
if (enableQueue) { if (enableQueue) {