-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix: resolve doubly linked list push issue #3085
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@ntvviktor looks like you broke the tests |
hey nkaradzhov, I am considering, even though fixing the code logic of the DoublyLinkedList will properly shut down the bad host request for redis connection, but it will break the sentinel client tests. I believe it has been somehow coded to pass with the error of issue: TypeError: Cannot set properties of undefined (setting 'next')
File "/app/node_modules/.pnpm/@redis+client@5.8.0/node_modules/@redis/client/dist/lib/client/linked-list.js", line 76, col 32, in DoublyLinkedList.remove
node.previous.next = node.next; I will investigate further to try to triage and fix the root cause. |
In the case of the issue above, seems like the async #create() {
const node = this._self.#clientsInUse.push(
this._self.#clientFactory()
.on('error', (err: Error) => this.emit('error', err))
);
try {
const client = node.value;
await client.connect();
} catch (err) {
this._self.#clientsInUse.remove(node);
throw err;
}
this._self.#returnClient(node);
} I fix using the if statement to check for the previous is not enough, and found out a root cause from RedisCommandQueue also using Doubly Linked List. I ran all tests locally and it currently works as expected. @nkaradzhov Please help me enable the pipeline to see whether my fix break anything. Thanks! |
* refactor(maint): rename options * fix(init): option parsing * refactor(client): #options cannot be undefined
Hi @nkaradzhov, please help me review the code, thanks in advance |
Description
Now the client pool properly shut down after getting a bad connection.
Checklist
npm test
pass with this change (including linting)?