You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-17 19:41:06 +03:00
better cluster nodes discorvery strategy after MOVED error, add PubSub test
This commit is contained in:
@@ -32,9 +32,17 @@ export default class RedisClusterSlots {
|
||||
throw new Error('None of the root nodes is available');
|
||||
}
|
||||
|
||||
async discover(): Promise<void> {
|
||||
// TODO: shuffle?
|
||||
async discover(startWith: RedisClient): Promise<void> {
|
||||
try {
|
||||
await this.#discoverNodes(startWith.options?.socket);
|
||||
return;
|
||||
} catch (err) {
|
||||
// this.emit('error', err);
|
||||
}
|
||||
|
||||
for (const client of this.#clientByKey.values()) {
|
||||
if (client === startWith) continue;
|
||||
|
||||
try {
|
||||
await this.#discoverNodes(client.options?.socket);
|
||||
return;
|
||||
|
Reference in New Issue
Block a user