Skip to content

Commit

Permalink
fix race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelvigee committed Apr 7, 2024
1 parent 6932b67 commit 0a30596
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions worker2/dep.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,19 @@ func (g *Group) LinkDeps() {
}

func (g *Group) GetDepsObj() *Deps {
if g.Deps != nil {
return g.Deps
}

g.m.Lock()
defer g.m.Unlock()

if g.Deps == nil {
g.Deps = NewDeps()
d := NewDeps()
d.setOwner(g)
g.Deps = d
}
g.Deps.setOwner(g)

return g.Deps
}

Expand Down

0 comments on commit 0a30596

Please sign in to comment.