From 02675c264e899df93ee92b770baa94d5d3d2ca2e Mon Sep 17 00:00:00 2001 From: cuiweixie Date: Tue, 8 Oct 2024 22:23:31 +0800 Subject: [PATCH] refactor: using maps.Clone --- das/reader_aggregator_strategies.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/das/reader_aggregator_strategies.go b/das/reader_aggregator_strategies.go index 8e10d52c16..e072fdd85c 100644 --- a/das/reader_aggregator_strategies.go +++ b/das/reader_aggregator_strategies.go @@ -5,6 +5,7 @@ package das import ( "errors" + "maps" "math/rand" "sort" "sync" @@ -33,10 +34,7 @@ func (s *abstractAggregatorStrategy) update(readers []daprovider.DASReader, stat s.readers = make([]daprovider.DASReader, len(readers)) copy(s.readers, readers) - s.stats = make(map[daprovider.DASReader]readerStats) - for k, v := range stats { - s.stats[k] = v - } + s.stats = maps.Clone(stats) } // Exponentially growing Explore Exploit Strategy