From 47f6409bb8bc49a50027b9579bb651c0506b6912 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 25 Apr 2019 11:27:13 +0200 Subject: Use apicache instead of our broken implementation --- server/lib/job-queue/job-queue.ts | 2 +- server/lib/redis.ts | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'server/lib') diff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.ts index f09eb6ff1..3c810da98 100644 --- a/server/lib/job-queue/job-queue.ts +++ b/server/lib/job-queue/job-queue.ts @@ -71,7 +71,7 @@ class JobQueue { this.jobRedisPrefix = 'bull-' + WEBSERVER.HOST const queueOptions = { prefix: this.jobRedisPrefix, - redis: Redis.getRedisClient(), + redis: Redis.getRedisClientOptions(), settings: { maxStalledCount: 10 // transcoding could be long, so jobs can often be interrupted by restarts } diff --git a/server/lib/redis.ts b/server/lib/redis.ts index b4044bf0f..f77d0b62c 100644 --- a/server/lib/redis.ts +++ b/server/lib/redis.ts @@ -31,7 +31,7 @@ class Redis { if (this.initialized === true) return this.initialized = true - this.client = createClient(Redis.getRedisClient()) + this.client = createClient(Redis.getRedisClientOptions()) this.client.on('error', err => { logger.error('Error in Redis client.', { err }) @@ -45,7 +45,7 @@ class Redis { this.prefix = 'redis-' + WEBSERVER.HOST + '-' } - static getRedisClient () { + static getRedisClientOptions () { return Object.assign({}, (CONFIG.REDIS.AUTH && CONFIG.REDIS.AUTH != null) ? { password: CONFIG.REDIS.AUTH } : {}, (CONFIG.REDIS.DB) ? { db: CONFIG.REDIS.DB } : {}, @@ -55,6 +55,14 @@ class Redis { ) } + getClient () { + return this.client + } + + getPrefix () { + return this.prefix + } + /************* Forgot password *************/ async setResetPasswordVerificationString (userId: number) { -- cgit v1.2.3