1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00

enhance cluster reshard handling

This commit is contained in:
leibale
2021-11-22 17:42:41 -05:00
parent 6946e36ba0
commit 42e36dfbb1
4 changed files with 76 additions and 28 deletions

View File

@ -157,7 +157,7 @@ export default class RedisCluster<M extends RedisModules = Record<string, never>
const url = err.message.substring(err.message.lastIndexOf(' ') + 1);
let node = this.#slots.getNodeByUrl(url);
if (!node) {
await this.#slots.discover(client);
await this.#slots.rediscover(client);
node = this.#slots.getNodeByUrl(url);
if (!node) {
@ -168,7 +168,7 @@ export default class RedisCluster<M extends RedisModules = Record<string, never>
await node.client.asking();
return node.client;
} else if (err.message.startsWith('MOVED')) {
await this.#slots.discover(client);
await this.#slots.rediscover(client);
return true;
}