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

Avoid panic when using dedicated client after being recycled, return an error instead #593

Closed FZambia closed 3 months ago

FZambia commented 4 months ago

Relates #586

This PR contains changes to avoid panicking with DedicatedClient should not be used after recycled, and return an error (specifically, ErrClosing) instead.

Please take a look. The thing I personally not sure whether it's semantically correct to use ErrClosing in these places. At first glance seems logical, but probably will require adjustments. Also, #586 mentions only panic for Do call, but I guess it should be extrapolated to all methods to fully eliminate panic.