diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2018-07-25 22:01:25 +0200 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2018-07-25 22:01:25 +0200 |
commit | c1e791bad0b079af67398f6407221e6dcbb573dd (patch) | |
tree | 82e5944b4458dd35aa482a38f6b650eb93bb89ad /server/initializers/migrations/0230-kue-to-bull.ts | |
parent | 5f7021c33d31c5255b995ae0ff86b5bbea4ea4b9 (diff) | |
download | PeerTube-c1e791bad0b079af67398f6407221e6dcbb573dd.tar.gz PeerTube-c1e791bad0b079af67398f6407221e6dcbb573dd.tar.zst PeerTube-c1e791bad0b079af67398f6407221e6dcbb573dd.zip |
expliciting type checks and predicates (server only)
Diffstat (limited to 'server/initializers/migrations/0230-kue-to-bull.ts')
-rw-r--r-- | server/initializers/migrations/0230-kue-to-bull.ts | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/server/initializers/migrations/0230-kue-to-bull.ts b/server/initializers/migrations/0230-kue-to-bull.ts index 5fad87a61..5f4d88bef 100644 --- a/server/initializers/migrations/0230-kue-to-bull.ts +++ b/server/initializers/migrations/0230-kue-to-bull.ts | |||
@@ -2,6 +2,7 @@ import * as Sequelize from 'sequelize' | |||
2 | import { createClient } from 'redis' | 2 | import { createClient } from 'redis' |
3 | import { CONFIG } from '../constants' | 3 | import { CONFIG } from '../constants' |
4 | import { JobQueue } from '../../lib/job-queue' | 4 | import { JobQueue } from '../../lib/job-queue' |
5 | import { Redis } from '../../lib/redis' | ||
5 | import { initDatabaseModels } from '../database' | 6 | import { initDatabaseModels } from '../database' |
6 | 7 | ||
7 | async function up (utils: { | 8 | async function up (utils: { |
@@ -12,11 +13,7 @@ async function up (utils: { | |||
12 | await initDatabaseModels(false) | 13 | await initDatabaseModels(false) |
13 | 14 | ||
14 | return new Promise((res, rej) => { | 15 | return new Promise((res, rej) => { |
15 | const client = createClient({ | 16 | const client = createClient(Redis.getRedisClient()) |
16 | host: CONFIG.REDIS.HOSTNAME, | ||
17 | port: CONFIG.REDIS.PORT, | ||
18 | db: CONFIG.REDIS.DB | ||
19 | }) | ||
20 | 17 | ||
21 | const jobsPrefix = 'q-' + CONFIG.WEBSERVER.HOST | 18 | const jobsPrefix = 'q-' + CONFIG.WEBSERVER.HOST |
22 | 19 | ||
@@ -36,7 +33,7 @@ async function up (utils: { | |||
36 | return res({ type: job.type, payload: parsedData }) | 33 | return res({ type: job.type, payload: parsedData }) |
37 | } catch (err) { | 34 | } catch (err) { |
38 | console.error('Cannot parse data %s.', job.data) | 35 | console.error('Cannot parse data %s.', job.data) |
39 | return res(null) | 36 | return res(undefined) |
40 | } | 37 | } |
41 | }) | 38 | }) |
42 | }) | 39 | }) |