From 676acc1ca2a7b148d0ace5742e1438cd1224284d Mon Sep 17 00:00:00 2001 From: Behrad Date: Fri, 20 Nov 2015 14:50:20 +0330 Subject: [PATCH] only use cluster prefix when using ioredis --- lib/redis.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/redis.js b/lib/redis.js index 3e8c2548..fe111d3c 100755 --- a/lib/redis.js +++ b/lib/redis.js @@ -66,9 +66,12 @@ exports.configureFactory = function( options, queue ) { client.prefix = options.prefix; // redefine getKey to use the configured prefix client.getKey = function( key ) { - // {prefix}:jobs format is needed in using ioredis cluster to keep they keys in same node - // otherwise multi commands fail ( since they use ioredis's pipeline ) - return '{' + this.prefix + '}:' + key; + if( client.constructor.name == 'Redis' ) { + // {prefix}:jobs format is needed in using ioredis cluster to keep they keys in same node + // otherwise multi commands fail, since they use ioredis's pipeline. + return '{' + this.prefix + '}:' + key; + } + return this.prefix + ':' + key; }; return client; };