Skip to content

facing issue with deadpool redis #314

Closed Answered by bikeshedder
rapidshaurya asked this question in Q&A
Discussion options

You must be logged in to vote

Deadpool itself is executor agnostic (except for timeouts). You're using deadpool-redis which does call into the redis library when creating new connections. The redis crate only supports tokio or async-std.

I don't think it is possilble to use futures::executor with the redis crate. And therefore you can't use futures::executor with deadpool-redis either.

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 block_on call. You'd be bet…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bikeshedder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants