From e78c374285b409a7016063ef1450744b67889e69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Levente=20T=C3=B3th?= Date: Fri, 1 Dec 2023 10:37:11 +0100 Subject: [PATCH] fix: put mutex lock because of race condition --- pkg/file/redundancy/getter/getter.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/file/redundancy/getter/getter.go b/pkg/file/redundancy/getter/getter.go index b9bcf973529..f767682452b 100644 --- a/pkg/file/redundancy/getter/getter.go +++ b/pkg/file/redundancy/getter/getter.go @@ -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