This is an automated email from the ASF dual-hosted git repository.

asifdxtreme pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/incubator-servicecomb-service-center.git


The following commit(s) were added to refs/heads/master by this push:
     new b87ea66  SCB-620 Switch to new client gracefully (#362)
b87ea66 is described below

commit b87ea66f7834d893aab7aa864df272e1c5ad9106
Author: little-cui <sure_0...@qq.com>
AuthorDate: Thu May 31 15:06:46 2018 +0800

    SCB-620 Switch to new client gracefully (#362)
---
 server/plugin/infra/registry/etcd/etcd.go | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/server/plugin/infra/registry/etcd/etcd.go 
b/server/plugin/infra/registry/etcd/etcd.go
index 9243edb..ffe1367 100644
--- a/server/plugin/infra/registry/etcd/etcd.go
+++ b/server/plugin/infra/registry/etcd/etcd.go
@@ -600,13 +600,14 @@ hcLoop:
                                util.Logger().Errorf(cerr, "re-get etcd client 
%v failed.", c.Endpoints)
                                continue
                        }
-                       cerr = c.Client.Close()
-                       if cerr != nil {
-                               util.Logger().Errorf(cerr, "close unavailable 
etcd client failed.")
-                       }
-                       c.Client = client
 
+                       c.Client, client = client, c.Client
                        util.Logger().Errorf(err, "Auto sync etcd members 
failed and re-connected etcd successfully")
+
+                       if cerr = client.Close(); cerr != nil {
+                               util.Logger().Errorf(cerr, "close unavailable 
etcd client failed.")
+                       }
+                       client = nil
                }
        }
 }

-- 
To stop receiving notification emails like this one, please contact
asifdxtr...@apache.org.

Reply via email to