Greetings!
I have a problem with non-closing connection when use ConnectionManager
. For example:
let mut redis = ConnectionManager::new(REDIS_CLIENT.clone()).await?;
<...>
let (tx, mut cancel) = mpsc::channel(1);
let task = tokio::task::spawn(async move {
loop {
let data = tokio::select! {
data = redis.xread_options::<_, _, StreamReadReply>(mwi, &now, &opts) => data,
_ = cancel.recv() => break,
};
<...>
}
});
When I send tx.send(()).await;
, yeah, loop are breaking. But, future with redis.xread_options
(from what I read) just suspends without releasing data. So, as a result, I got a dangling connection to Redis DB.
If xread get some data after abortion, connection will be closed.
P.S. Author of redis-rs doesn't answer: `tokio::select` with async ConnectionManager and channel for cancelation · Issue #553 · redis-rs/redis-rs · GitHub