redis / go-redis

Redis Go client
https://redis.uptrace.dev
BSD 2-Clause "Simplified" License
19.61k stars 2.31k forks source link

Attempt to Close Sentinel when the NewFailoverClusterClient is Closed. #2968

Open DevineLiu opened 2 months ago

DevineLiu commented 2 months ago

We should have a means to reclaim the sentinels' connection resources established by NewFailoverClusterClient.

monkey92t commented 2 months ago

I didn't understand this PR. What does it mean?

DevineLiu commented 2 months ago

When using NewFailoverClusterClient for initialization, at line 788, the code initializes connections to the Sentinels, and at line 792, the client subscribes to the Sentinel. However, the long-lived connection between the client and the Sentinel doesn't get closed when Close is called on the ClusterClient returned by NewFailoverClient.

This issue occurs when the Close method is called on ClusterClient, and the long-lived connection to the Sentinel is not closed along with it.