Skip to content

Commit

Permalink
Add support for IORedis.Cluster type in ConnectionOptions for TypeScr…
Browse files Browse the repository at this point in the history
…ipt (#438)

* Add support for IORedis.Cluster type in ConnectionOptions for TypeScript

* Add brief documentation that redisCluster is also supported
  • Loading branch information
glensc authored Sep 10, 2020
1 parent d953be5 commit ed8339f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,14 @@ You can also pass redis client directly.

```javascript
// assume you already initialized redis client before
// the "redis" key can be IORedis.Redis or IORedis.Cluster instance

var redisClient = new Redis();
var connectionDetails = { redis: redisClient };

var redisCluster = new Cluster();
var connectionDetails = { redis: redisCluster };

var worker = new NodeResque.Worker(
{ connection: connectionDetails, queues: "math" },
jobs
Expand Down
2 changes: 1 addition & 1 deletion src/core/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class Connection extends EventEmitter {
options: ConnectionOptions | null;
private eventListeners: EventListeners;
connected: boolean;
redis: IORedis.Redis;
redis: IORedis.Redis | IORedis.Cluster;

constructor(options: ConnectionOptions = {}) {
super();
Expand Down
2 changes: 1 addition & 1 deletion src/types/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface ConnectionOptions {
namespace?: string;
looping?: boolean;
options?: any;
redis?: IORedis.Redis;
redis?: IORedis.Redis | IORedis.Cluster;
scanCount?: number;
}

Expand Down

0 comments on commit ed8339f

Please sign in to comment.