You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Fix race condition when slots are re-calculated (#2731)
This commit is contained in:
@@ -158,13 +158,13 @@ export default class RedisClusterSlots<
|
|||||||
}
|
}
|
||||||
|
|
||||||
async #discover(rootNode?: RedisClusterClientOptions) {
|
async #discover(rootNode?: RedisClusterClientOptions) {
|
||||||
this.#resetSlots();
|
|
||||||
const addressesInUse = new Set<string>();
|
const addressesInUse = new Set<string>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const shards = await this.#getShards(rootNode),
|
const shards = await this.#getShards(rootNode),
|
||||||
promises: Array<Promise<unknown>> = [],
|
promises: Array<Promise<unknown>> = [],
|
||||||
eagerConnect = this.#options.minimizeConnections !== true;
|
eagerConnect = this.#options.minimizeConnections !== true;
|
||||||
|
this.#resetSlots();
|
||||||
for (const { from, to, master, replicas } of shards) {
|
for (const { from, to, master, replicas } of shards) {
|
||||||
const shard: Shard<M, F, S> = {
|
const shard: Shard<M, F, S> = {
|
||||||
master: this.#initiateSlotNode(master, false, eagerConnect, addressesInUse, promises)
|
master: this.#initiateSlotNode(master, false, eagerConnect, addressesInUse, promises)
|
||||||
|
Reference in New Issue
Block a user