From f91819ef67bcd2ca7e31d1cb038e54853c7e7cf9 Mon Sep 17 00:00:00 2001 From: Clement Sam Date: Thu, 18 Apr 2024 14:26:52 +0000 Subject: [PATCH] storagenode/trust: fix data race Change-Id: Ia821a238c90ffb5f3abdc8042aff1b75cfc74ce4 --- storagenode/trust/service.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/storagenode/trust/service.go b/storagenode/trust/service.go index 846f8cd6e7ed..1abb679710f9 100644 --- a/storagenode/trust/service.go +++ b/storagenode/trust/service.go @@ -159,9 +159,13 @@ func (pool *Pool) GetSignee(ctx context.Context, id storj.NodeID) (_ signing.Sig // GetSatellites returns a slice containing all trusted satellites. func (pool *Pool) GetSatellites(ctx context.Context) (satellites []storj.NodeID) { defer mon.Task()(&ctx)(nil) + + pool.satellitesMu.RLock() for sat := range pool.satellites { satellites = append(satellites, sat) } + pool.satellitesMu.RUnlock() + sort.Sort(storj.NodeIDList(satellites)) return satellites }