facing issue with deadpool redis #314
-
When using futures::executor::block_on() function with pool.get(), the code is still waiting for a long time, and nothing is happening. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Deadpool itself is executor agnostic (except for timeouts). You're using I don't think it is possilble to use This should work (using tokio): use tokio::runtime::Handle;
let handle = Handle::current();
let conn = handle.block_on(pool.get()); Though I really wonder why you want to use deadpool in sync code for fetching an async redis connection object. The only way to use the obtained connection object is via another |
Beta Was this translation helpful? Give feedback.
Deadpool itself is executor agnostic (except for timeouts). You're using
deadpool-redis
which does call into theredis
library when creating new connections. Theredis
crate only supportstokio
orasync-std
.I don't think it is possilble to use
futures::executor
with theredis
crate. And therefore you can't usefutures::executor
withdeadpool-redis
either.This should work (using tokio):
Though I really wonder why you want to use deadpool in sync code for fetching an async redis connection object. The only way to use the obtained connection object is via another
block_on
call. You'd be bet…