Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/cluster/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ class Cluster extends Commander {
super();
EventEmitter.call(this);

this.startupNodes = startupNodes;
this.startupNodes = startupNodes
?.map((node) => (typeof node === 'string' ? node.split(',') : [node]))
.flat();

this.options = defaults({}, options, DEFAULT_CLUSTER_OPTIONS, this.options);

if (this.options.shardedSubscribers == true)
Expand Down
11 changes: 11 additions & 0 deletions test/functional/cluster/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ describe("cluster:connect", () => {
});
});

it("should support url schema with mutiple nodes", (done) => {
const node = new MockServer(30001);

const cluster = new Cluster([30002, "127.0.0.4:30001", { host:"127.0.0.3", port: 30001 }, "redis://127.0.0.2:30001,127.0.0.1:30001"]);

node.once("connect", () => {
cluster.disconnect();
done();
});
});

it("should support a single port", (done) => {
const node = new MockServer(30001);

Expand Down