Comments (12)
I'm sorry, but it would be hard to help here without compiling code. Can you provide a full example?
from redis-rs.
Thanks. updated the code
from redis-rs.
no, this still won't compile - what are all the mod
s you're referencing? can you create a sample repository, or better yet, recreate this in redis-rs' tests?
from redis-rs.
and I hope it's clear - you're referencing 4 mod
s here. If they're large, we won't go over them to find your bug. Please post a minimal sample repository.
from redis-rs.
This example has rest of the code https://github.com/paoloposso/rust_redis_pubsub/tree/main/src
from redis-rs.
ok, what am I supposed to see in this code example? how does it demonstrate the issue?
I see 3 messages published, and that 3 messages are printed to console with "published" printed somewhere in-between. This is expected. Then the program hangs, because redis_subscrober spawned a task that never completes.
I also see that you create a new connection for each published message, which isn't an optimal usage of resources.
What issue does this demonstrate?
from redis-rs.
Please publish the messages in a loop of 100,000 and run.
from redis-rs.
which loop? there's no loop in main.rs.
from redis-rs.
you can see the loop in the main.rs I posted above
from redis-rs.
You're right, this does reproduce as given. But, when I removed the serde dependency, this doesn't reproduce - I ran the code to 600K operations, and counting.
Why do you think this is an issue with the redis crate?
from redis-rs.
Sorry, I made a mistake - the example still gets stuck at the end of the loop, regardless of how large the loop is - probably because of the spawned task that never completes. Once I changed the spawned task to complete with
pub fn subscribe(channel: String) -> Result<(), Box<dyn Error>> {
let _ = tokio::spawn(async move {
let client = redis::Client::open("redis://localhost").unwrap();
let mut con = client.get_connection().unwrap();
let mut i = 0;
let _: () = con
.subscribe(&[channel], |msg| {
i += 1;
let received: String = msg.get_payload().unwrap();
println!("{received}");
return if i == 157126 {
ControlFlow::Break(())
} else {
ControlFlow::Continue
};
})
.unwrap();
});
Ok(())
}
the application completed successfully.
from redis-rs.
@jayeshpk1 was your issue solved? can this issue be closed?
from redis-rs.
Related Issues (20)
- support maybe async HOT 1
- multiplex connection doesn't recover from ErrorKind::IoError HOT 5
- add ability to specify count for scan match HOT 2
- provide two-stage api for MultiplexedConnection HOT 6
- Things to complete for 0.26v HOT 3
- ConnectionManager with broken pipe HOT 2
- Issue with a simple GET command HOT 3
- Warning about Rust 2024 with the newest Nightly Compiler: `this function depends on never type fallback being ()` HOT 17
- [Redis Cluster] How scan by every nodes HOT 3
- is there a reason test_block_on_all_panics_from_spawns test is not marked as #[should_panic]? HOT 2
- Blocking operations and aio MultiplexedConnection HOT 14
- Master with given name not found in sentinel- MasterNameNotFoundBySentinel HOT 6
- Connection Timeout leads to data corruption HOT 1
- My Redis server enabled kerber verification, Can I use this client for it? HOT 1
- Support `query_async` for `ClusterPipeline` HOT 5
- Using redis with rustls is blocking HOT 2
- Alternatives to aio::Connection in combination with WATCH HOT 1
- How to dynamically reconstruct a Redis client based on cluster information? HOT 3
- EVALSHA in cluster pipelines HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redis-rs.