From 855607c5360c788959d8a6bfd0225a75b63dc51f Mon Sep 17 00:00:00 2001 From: "M@" Date: Thu, 25 Apr 2024 02:18:28 -0400 Subject: [PATCH] Fixes race with unlocked setter. (#5532) --- weed/cluster/lock_manager/lock_ring.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/weed/cluster/lock_manager/lock_ring.go b/weed/cluster/lock_manager/lock_ring.go index c59aab184..9edee1e96 100644 --- a/weed/cluster/lock_manager/lock_ring.go +++ b/weed/cluster/lock_manager/lock_ring.go @@ -72,7 +72,9 @@ func (r *LockRing) SetSnapshot(servers []pb.ServerAddress) { return servers[i] < servers[j] }) + r.Lock() r.lastUpdateTime = time.Now() + r.Unlock() r.addOneSnapshot(servers)