-
Notifications
You must be signed in to change notification settings - Fork 537
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
hscan_match no longer works on async connections #695
Comments
Thanks for the report, looking into it. |
Ok, having looked into this further, the issue is that the return type is invalid -- the Apologies for any confusion here. This could have been documented a bit better, and the error handling in the |
Thanks for the investigation! For anyone elses reference, this means that async was irrelevant and this was all that was needed to reproduce the failure: #[test]
fn test_filtered_scanning() {
let ctx = TestContext::new();
let mut con = ctx.connection();
let mut unseen = HashSet::new();
for x in 0..3000 {
let _: () = con
.hset("foo", format!("key_{}_{}", x % 100, x), x)
.unwrap();
if x % 100 == 0 {
unseen.insert(x);
}
}
let iter = con
.hscan_match::<&str, &str, usize>("foo", "key_0_*")
.unwrap();
for value in iter {
unseen.remove(&value);
}
assert_eq!(unseen.len(), 0);
} The fix was: let iter = con
.hscan_match::<&str, &str, (String, usize)>("foo", "key_0_*")
.unwrap();
for (_field, value) in iter {
unseen.remove(&value);
} I do find it concerning that redis-rs would just return nothing here rather than give some kind of error. I'm going to leave this open in case you want to document this state of affairs at all, otherwise feel free to close this issue. |
I think the core issue is the way our iterators bury errors. There's no direct way to tell if a particular command fails or a return value fails parsing other than the iterator returning |
hscan_match (possibly other commands, I havent checked) no longer returns any items on an async connection in redis-rs 0.22, it worked fine in redis-rs 0.21
I modified the test_filtered_scanning test to reproduce the issue:
The text was updated successfully, but these errors were encountered: