Skip to content

Commit

Permalink
fix: put mutex lock because of race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
nugaon committed Dec 1, 2023
1 parent 155e846 commit e78c374
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/file/redundancy/getter/getter.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,13 @@ func (g *getter) executeStrategies(ctx context.Context, addr swarm.Address) (swa

// initWaitChannels initializes the wait channels in the cache mapping which indicates the start of the recovery process as well
func (g *getter) initWaitChannels() {
g.mu.Lock()
for _, addr := range g.sAddresses {
iCh := g.cache[addr.String()]
iCh.wait = make(chan struct{})
g.cache[addr.String()] = iCh
}
g.mu.Unlock()
}

// closeChannls closes all pending channels
Expand Down

0 comments on commit e78c374

Please sign in to comment.