From 3a2751cd3133825b6ecd623dfe7dbd2335bedef5 Mon Sep 17 00:00:00 2001 From: stream1080 <77672403+stream1080@users.noreply.github.com> Date: Sun, 1 Oct 2023 12:13:14 +0800 Subject: [PATCH] feat: add cluster returnPeerClient() func --- cluster/com.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cluster/com.go b/cluster/com.go index 95d8ccc..a215758 100644 --- a/cluster/com.go +++ b/cluster/com.go @@ -24,3 +24,12 @@ func (cluster *ClusterDatabases) getPeerClient(peer string) (*client.Client, err return c, nil } + +func (cluster *ClusterDatabases) returnPeerClient(peer string, client *client.Client) error { + pool, ok := cluster.peerConn[peer] + if !ok { + return errors.New("conn not found") + } + + return pool.ReturnObject(context.Background(), client) +}