You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The usual way to solve this is to wrap the call to to_socket_addrs in a "spawn_blocking", both tokio and async-std have utility functions for that. I guess we could either add spawn_blocking to the RedisRuntime trait, or a more specific method, like get_socket_addrs or lookup_host. I think I would prefer the most general spawn_blocking, since it can be useful for other stuff.
I can provide a PR once there's a minimal consensus on the proper solution.
The text was updated successfully, but these errors were encountered:
connect_simple
(which is async) callsget_socket_addrs
:https://github.com/mitsuhiko/redis-rs/blob/b8eb47303c5728e943b914cd10dc35d1fceee05c/src/aio.rs#L459
Which will end up calling the libstd implementation of
ToSocketAddrs
forstr
, this will block if the str is a hostname:https://github.com/mitsuhiko/redis-rs/blob/b8eb47303c5728e943b914cd10dc35d1fceee05c/src/aio.rs#L496
The usual way to solve this is to wrap the call to
to_socket_addrs
in a "spawn_blocking", bothtokio
andasync-std
have utility functions for that. I guess we could either addspawn_blocking
to theRedisRuntime
trait, or a more specific method, likeget_socket_addrs
orlookup_host
. I think I would prefer the most generalspawn_blocking
, since it can be useful for other stuff.I can provide a PR once there's a minimal consensus on the proper solution.
The text was updated successfully, but these errors were encountered: