1
0
mirror of https://github.com/redis/node-redis.git synced 2025-12-11 09:22:35 +03:00

fix: resolve doubly linked list push issue (#3085)

* fix redis sentinel failover

* fix: resolve doubly linked list push issue

* fix semicolon syntax

* correctly set the removed node ref

* fix linked list node iterator

* revert push logic and refactor remove logic

* add linked list tests
This commit is contained in:
Vuong Ngo (Viktor)
2025-10-02 17:39:39 +07:00
committed by GitHub
parent 17fc725536
commit 73413e086c
3 changed files with 59 additions and 11 deletions

View File

@@ -928,6 +928,16 @@ class RedisSentinelInternal<
}
}
#handleSentinelFailure(node: RedisNode) {
const found = this.#sentinelRootNodes.findIndex(
(rootNode) => rootNode.host === node.host && rootNode.port === node.port
);
if (found !== -1) {
this.#sentinelRootNodes.splice(found, 1);
}
this.#reset();
}
async close() {
this.#destroy = true;
@@ -1197,8 +1207,9 @@ class RedisSentinelInternal<
error: err
};
this.emit('client-error', event);
this.#reset();
});
this.#handleSentinelFailure(node);
})
.on('end', () => this.#handleSentinelFailure(node));
this.#sentinelClient = client;
this.#trace(`transform: adding sentinel client connect() to promise list`);