Is there any option to set the closing callback for a node client in ClusterClient?
Use Case
I want to start metrics collection process on every new node client creation and stop it when the node client is removed for some reason. To stop the process I have to provide a callback somehow. To start the process I can use ClusterClient.OnNewNode.
Ideas
One solution that comes to my mind is to add a callback to the return function that the ClusterClient.OnNewNode accepts:
Good day!
Is there any option to set the closing callback for a node client in ClusterClient?
Use Case I want to start metrics collection process on every new node client creation and stop it when the node client is removed for some reason. To stop the process I have to provide a callback somehow. To start the process I can use
ClusterClient.OnNewNode
.Ideas One solution that comes to my mind is to add a callback to the return function that the
ClusterClient.OnNewNode
accepts:This callback should be added to the
clusterNode
and called inside it'sClose
method.However, to avoid breaking backward compatibility, it's possible to add a separate method for
ClusterClient
, such asOnNewNodeWithClose
.Another idea is to expand the
redis.Hook
interface to provide additionalCloseHook
method.Thanks for any feedback in advance.