diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-25 11:27:13 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-25 11:27:13 +0200 |
commit | 47f6409bb8bc49a50027b9579bb651c0506b6912 (patch) | |
tree | bcf27fb4bffa2c10c5374da60457e025078c1acf /server/lib | |
parent | d0dba1fce6dcc0b91c0561eda8707c5c5bb6e626 (diff) | |
download | PeerTube-47f6409bb8bc49a50027b9579bb651c0506b6912.tar.gz PeerTube-47f6409bb8bc49a50027b9579bb651c0506b6912.tar.zst PeerTube-47f6409bb8bc49a50027b9579bb651c0506b6912.zip |
Use apicache instead of our broken implementation
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/job-queue/job-queue.ts | 2 | ||||
-rw-r--r-- | server/lib/redis.ts | 12 |
2 files changed, 11 insertions, 3 deletions
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 { | |||
71 | this.jobRedisPrefix = 'bull-' + WEBSERVER.HOST | 71 | this.jobRedisPrefix = 'bull-' + WEBSERVER.HOST |
72 | const queueOptions = { | 72 | const queueOptions = { |
73 | prefix: this.jobRedisPrefix, | 73 | prefix: this.jobRedisPrefix, |
74 | redis: Redis.getRedisClient(), | 74 | redis: Redis.getRedisClientOptions(), |
75 | settings: { | 75 | settings: { |
76 | maxStalledCount: 10 // transcoding could be long, so jobs can often be interrupted by restarts | 76 | maxStalledCount: 10 // transcoding could be long, so jobs can often be interrupted by restarts |
77 | } | 77 | } |
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 { | |||
31 | if (this.initialized === true) return | 31 | if (this.initialized === true) return |
32 | this.initialized = true | 32 | this.initialized = true |
33 | 33 | ||
34 | this.client = createClient(Redis.getRedisClient()) | 34 | this.client = createClient(Redis.getRedisClientOptions()) |
35 | 35 | ||
36 | this.client.on('error', err => { | 36 | this.client.on('error', err => { |
37 | logger.error('Error in Redis client.', { err }) | 37 | logger.error('Error in Redis client.', { err }) |
@@ -45,7 +45,7 @@ class Redis { | |||
45 | this.prefix = 'redis-' + WEBSERVER.HOST + '-' | 45 | this.prefix = 'redis-' + WEBSERVER.HOST + '-' |
46 | } | 46 | } |
47 | 47 | ||
48 | static getRedisClient () { | 48 | static getRedisClientOptions () { |
49 | return Object.assign({}, | 49 | return Object.assign({}, |
50 | (CONFIG.REDIS.AUTH && CONFIG.REDIS.AUTH != null) ? { password: CONFIG.REDIS.AUTH } : {}, | 50 | (CONFIG.REDIS.AUTH && CONFIG.REDIS.AUTH != null) ? { password: CONFIG.REDIS.AUTH } : {}, |
51 | (CONFIG.REDIS.DB) ? { db: CONFIG.REDIS.DB } : {}, | 51 | (CONFIG.REDIS.DB) ? { db: CONFIG.REDIS.DB } : {}, |
@@ -55,6 +55,14 @@ class Redis { | |||
55 | ) | 55 | ) |
56 | } | 56 | } |
57 | 57 | ||
58 | getClient () { | ||
59 | return this.client | ||
60 | } | ||
61 | |||
62 | getPrefix () { | ||
63 | return this.prefix | ||
64 | } | ||
65 | |||
58 | /************* Forgot password *************/ | 66 | /************* Forgot password *************/ |
59 | 67 | ||
60 | async setResetPasswordVerificationString (userId: number) { | 68 | async setResetPasswordVerificationString (userId: number) { |