From d2bb058499a0adabbb9512af65188524f5e98427 Mon Sep 17 00:00:00 2001 From: scott <scottwangsxll@gmail.com> Date: Sun, 15 Mar 2020 21:33:08 +0800 Subject: [PATCH] Fix lock scop --- remoting/kubernetes/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/remoting/kubernetes/client.go b/remoting/kubernetes/client.go index 43b8dd4ec..3072aee2c 100644 --- a/remoting/kubernetes/client.go +++ b/remoting/kubernetes/client.go @@ -459,8 +459,6 @@ func (c *Client) Create(k, v string) error { // 1. accord old pod && (k, v) assemble new pod dubbo annotion v // 2. get patch data // 3. PATCH the pod - c.lock.Lock() - defer c.lock.Unlock() currentPod, err := c.readCurrentPod() if err != nil { @@ -482,7 +480,9 @@ func (c *Client) Create(k, v string) error { return perrors.WithMessage(err, "patch current pod") } + c.lock.Lock() c.currentPod = updatedPod + c.lock.Unlock() // not update the watcherSet, the watcherSet should be write by the watchPodsLoop return nil } -- GitLab