From 6ec2074da47d3da1fa544b5fe374377581b4a060 Mon Sep 17 00:00:00 2001 From: "zhenshan.cao" Date: Thu, 10 Jun 2021 14:57:55 +0800 Subject: [PATCH] [skip ci] Fix bug: concurrent map read and map write (#5713) Signed-off-by: zhenshan.cao --- internal/proxynode/channels_time_ticker.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/proxynode/channels_time_ticker.go b/internal/proxynode/channels_time_ticker.go index fa3c27ee0e..1bd582b8bb 100644 --- a/internal/proxynode/channels_time_ticker.go +++ b/internal/proxynode/channels_time_ticker.go @@ -57,7 +57,12 @@ func (ticker *channelsTimeTickerImpl) getMinTsStatistics() (map[pChan]Timestamp, ticker.statisticsMtx.RLock() defer ticker.statisticsMtx.RUnlock() - return ticker.minTsStatistics, nil + ret := make(map[pChan]Timestamp) + for k, v := range ticker.minTsStatistics { + ret[k] = v + } + + return ret, nil } func (ticker *channelsTimeTickerImpl) initStatistics() {