diff options
| author | Aya Morisawa <AyaMorisawa4869@gmail.com> | 2019-02-06 22:44:55 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2019-02-06 22:44:55 +0900 |
| commit | 96bc17aa1014983d5e6bf8b4c05d898156995a0d (patch) | |
| tree | fdf7c68bdbf3784988351004127db988d7c40c29 /src/queue | |
| parent | Fix bug (diff) | |
| download | sharkey-96bc17aa1014983d5e6bf8b4c05d898156995a0d.tar.gz sharkey-96bc17aa1014983d5e6bf8b4c05d898156995a0d.tar.bz2 sharkey-96bc17aa1014983d5e6bf8b4c05d898156995a0d.zip | |
Check config on load (#4170)
Co-authored-by: syuilo <syuilotan@yahoo.co.jp>
Diffstat (limited to 'src/queue')
| -rw-r--r-- | src/queue/index.ts | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/queue/index.ts b/src/queue/index.ts index 5d3baa8243..28768bf38f 100644 --- a/src/queue/index.ts +++ b/src/queue/index.ts @@ -8,17 +8,17 @@ import handler from './processors'; import { queueLogger } from './logger'; const enableQueue = !program.disableQueue; -const queueAvailable = config.redis != null; +const queueAvailable = config.redis.isJust(); const queue = initializeQueue(); function initializeQueue() { - if (queueAvailable) { + return config.redis.map(({ port, host, pass }) => { return new Queue('misskey', { redis: { - port: config.redis.port, - host: config.redis.host, - password: config.redis.pass + port: port, + host: host, + password: pass.getOrElse(null) }, removeOnSuccess: true, @@ -27,9 +27,7 @@ function initializeQueue() { sendEvents: false, storeJobs: false }); - } else { - return null; - } + }).getOrElse(null); } export function deliver(user: ILocalUser, content: any, to: any) { |