redis / rueidis

A fast Golang Redis client that supports Client Side Caching, Auto Pipelining, Generics OM, RedisJSON, RedisBloom, RediSearch, etc.
Apache License 2.0
2.46k stars 158 forks source link

Move sleep into goroutine in `LazyDo` #659

Closed justinmir closed 2 weeks ago

justinmir commented 3 weeks ago

This moves the sleep of up to threshold out of the caller's request path. This allows callers to use LazyDo without sleeping for up to threshold when called in succession.

This allows requests to connections that fail to return immediately instead of waiting for a second when they are selected to lazily perform the topology refresh.

Discussed here: https://github.com/redis/rueidis/issues/658

rueian commented 2 weeks ago

Thanks @justinmir!