Improve lock ring (#6921)

* fix flaky lock ring test

* add more tests
This commit is contained in:
Chris Lu
2025-06-24 23:04:39 -07:00
committed by GitHub
parent 4511c2cc1f
commit 95261a712e
2 changed files with 63 additions and 11 deletions

View File

@@ -184,6 +184,13 @@ func (r *LockRing) WaitForCleanup() {
r.cleanupWg.Wait()
}
// GetSnapshotCount safely returns the number of snapshots for testing
func (r *LockRing) GetSnapshotCount() int {
r.RLock()
defer r.RUnlock()
return len(r.snapshots)
}
func hashKeyToServer(key string, servers []pb.ServerAddress) pb.ServerAddress {
if len(servers) == 0 {
return ""