-
-
Save Jinnrry/d11a8c7dc74da724832206749afa12d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (ms *metricSender) asyncSendMetricLoop() { | |
for i := 0; i < ms.goNum; i++ { // goNum变量应该是1 | |
go ms.sendMetricFromChan(ms.metricInfoChans[i]) | |
} | |
} | |
func (ms *metricSender) sendMetricFromChan(metricInfoChan chan *metricCell) { | |
defer func() { | |
ms.closeWG.Done() | |
if r := recover(); r != nil { | |
go ms.sendMetricFromChan(metricInfoChan) | |
} | |
}() | |
ms.closeWG.Add(1) | |
for { | |
mc, ok := <-metricInfoChan | |
if !ok { | |
return | |
} | |
Counter(ms.name, mc.tags) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment