Skip to content

Commit

Permalink
only use cluster prefix when using ioredis
Browse files Browse the repository at this point in the history
  • Loading branch information
behrad committed Nov 20, 2015
1 parent 06fcc4d commit 676acc1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/redis.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit 676acc1

Please sign in to comment.