-
Notifications
You must be signed in to change notification settings - Fork 138
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
fix redis cluster test_recycled test #345
fix redis cluster test_recycled test #345
Conversation
Worked on my machine 🙃 |
The code is nicer to look at but I don't see how it would change the outcome of the test. 🤔 It's just a refactoring and not a change on what the test does. Maybe the test is flawed to begin with? I seriously don't know how redis does work in cluster mode. It almost looks like the connection is switching servers in a random fashion? |
I'm actually surprised that this code compiles to begin with: drop(client_id_1);
// ...
assert_eq!(
client_id_1, client_id_2,
"The Redis connection was not recycled"
); I would have expected that Rust doesn't allow accessing a value after it's dropped. It works because The |
Redis cluster might redirect connections to different nodes, potentially resulting in different client_ids even if the connection is logically the same |
Does it change servers in between The latest code you committed doesn't test anything. It just creates a variable (wrapped inside an let mut reused = false;
reused = true;
assert!(reused); You could compare the address of the underlying connection object via std::ptr::eq of the object returned by dereferencing the deadpool object. I think I remember why this test was added in the first place. Some version of |
Would you prefer comparing a set name or the address of the underlying connection object? |
It's pretty wild that the test using If the underlying connection is changed the underlying |
Why you cant compare client ID in this case idk, but client IDs are not a reliable way to check connection reuse, it can change even if the logical client remains the same it seems. |
LGTM. I wonder why the CI pipeline didn't complain about the unused imports. That used to work. 🤔 I'll merge this PR as is. The test seams to be fixed! 👍 |
Thanks a lot. 🥳 I just released |
No description provided.