mirror of
https://github.com/coder/coder.git
synced 2026-09-22 05:05:20 +08:00
fix(enterprise/replicasync): fix data race in Manager.Regional (#8910)
This commit is contained in:
@@ -375,7 +375,13 @@ func (m *Manager) InRegion(regionID int32) []database.Replica {
|
||||
|
||||
// Regional returns all replicas in the same region excluding itself.
|
||||
func (m *Manager) Regional() []database.Replica {
|
||||
return m.InRegion(m.self.RegionID)
|
||||
return m.InRegion(m.regionID())
|
||||
}
|
||||
|
||||
func (m *Manager) regionID() int32 {
|
||||
m.mutex.Lock()
|
||||
defer m.mutex.Unlock()
|
||||
return m.self.RegionID
|
||||
}
|
||||
|
||||
// SetCallback sets a function to execute whenever new peers
|
||||
|
||||
Reference in New Issue
Block a user