Skip to content

Commit 562608a

Browse files
afoninskyAVVS
authored andcommitted
fix: support redis sentinel in migrations (#394)
* feat: support redis sentinel in migrations * chore: add prometheus / healthcheck support
1 parent 551c4df commit 562608a

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/configs/core.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ exports.plugins = [
5050
'amqp',
5151
'redisCluster',
5252
'http',
53+
'prometheus',
5354
];
5455

5556
/**

src/configs/router.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ exports.router = {
3434
directory: path.resolve(__dirname, '../actions'),
3535
prefix: 'users',
3636
transports: [ActionTransport.amqp, ActionTransport.http, ActionTransport.internal],
37+
enabledGenericActions: ['health'],
3738
},
3839
extensions: {
3940
enabled: ['preRequest', 'postRequest', 'postValidate', 'preResponse'],

src/migrations/referrals-users-ids/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ const { USERS_REFERRAL_INDEX } = require('../../constants.js');
44
const { getUserId } = require('../../utils/userData');
55

66
/**
7-
*
7+
* Return master node in case of redisCluster to be able to use
8+
* specific commands like `keys`. We can use usual redis instance in
9+
* other cases.
810
*/
911
function getRedisMasterNode(redis, config) {
12+
if (!config.plugins.includes('redisCluster')) {
13+
return redis;
14+
}
1015
const { keyPrefix } = config.redis.options;
1116
const slot = calcSlot(keyPrefix);
1217
const nodeKeys = redis.slots[slot];

0 commit comments

Comments
 (0)