Fix deadlock of channels time ticker (#7444)

Signed-off-by: dragondriver <jiquan.long@zilliz.com>
This commit is contained in:
dragondriver 2021-09-03 11:53:29 +08:00 committed by GitHub
parent 8b1ae98fa9
commit 9b87da1ee8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,17 +92,18 @@ func (ticker *channelsTimeTickerImpl) tick() error {
return err
}
stats, err := ticker.getStatisticsFunc()
if err != nil {
log.Debug("Proxy channelsTimeTickerImpl failed to getStatistics", zap.Error(err))
return nil
}
ticker.statisticsMtx.Lock()
defer ticker.statisticsMtx.Unlock()
ticker.currentsMtx.Lock()
defer ticker.currentsMtx.Unlock()
stats, err := ticker.getStatisticsFunc()
if err != nil {
log.Debug("Proxy channelsTimeTickerImpl failed to getStatistics", zap.Error(err))
}
for pchan := range ticker.currents {
current := ticker.currents[pchan]
stat, ok := stats[pchan]