Skip to content

Commit

Permalink
Fix race condition when slots are re-calculated (#2731)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjsimps authored May 16, 2024
1 parent dbf8f59 commit bfa803f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/client/lib/cluster/cluster-slots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ export default class RedisClusterSlots<
}

async #discover(rootNode?: RedisClusterClientOptions) {
this.#resetSlots();
const addressesInUse = new Set<string>();

try {
const shards = await this.#getShards(rootNode),
promises: Array<Promise<unknown>> = [],
eagerConnect = this.#options.minimizeConnections !== true;
this.#resetSlots();
for (const { from, to, master, replicas } of shards) {
const shard: Shard<M, F, S> = {
master: this.#initiateSlotNode(master, false, eagerConnect, addressesInUse, promises)
Expand Down

0 comments on commit bfa803f

Please sign in to comment.