Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 618c6dc commit fda71daCopy full SHA for fda71da
enterprise/replicasync/replicasync.go
@@ -315,7 +315,14 @@ func (m *Manager) Self() database.Replica {
315
func (m *Manager) All() []database.Replica {
316
m.mutex.Lock()
317
defer m.mutex.Unlock()
318
- return append(m.peers[:], m.self)
+ replicas := make([]database.Replica, 0, len(m.peers))
319
+ for _, replica := range append(m.peers, m.self) {
320
+ // When we assign the non-pointer to a
321
+ // variable it loses the reference.
322
+ replica := replica
323
+ replicas = append(replicas, replica)
324
+ }
325
+ return replicas
326
}
327
328
// Regional returns all replicas in the same region excluding itself.
0 commit comments