Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfda71da

Browse files
authored
fix: Copy replicas to prevent race (#4596)
This was seen inhttps://github.com/coder/coder/actions/runs/3267638198/jobs/5373066836
1 parent618c6dc commitfda71da

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎enterprise/replicasync/replicasync.go‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,14 @@ func (m *Manager) Self() database.Replica {
315315
func (m*Manager)All() []database.Replica {
316316
m.mutex.Lock()
317317
deferm.mutex.Unlock()
318-
returnappend(m.peers[:],m.self)
318+
replicas:=make([]database.Replica,0,len(m.peers))
319+
for_,replica:=rangeappend(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+
returnreplicas
319326
}
320327

321328
// Regional returns all replicas in the same region excluding itself.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp