MCPcopy
hub / github.com/TarsCloud/TarsGo / Run

Method Run

tars/statf.go:137–154  ·  view source on GitHub ↗

Run stat report loop

()

Source from the content-addressed store, hash-verified

135
136// Run stat report loop
137func (s *StatFHelper) Run() {
138 ticker := time.NewTicker(s.app.ServerConfig().StatReportInterval)
139 for {
140 select {
141 case stStatInfo := <-s.chStatInfo:
142 s.collectMsg(stStatInfo, s.mStatInfo, s.mStatCount)
143 case stStatInfoFromServer := <-s.chStatInfoFromServer:
144 s.collectMsg(stStatInfoFromServer, s.mStatInfoFromServer, s.mStatCountFromServer)
145 case <-ticker.C:
146 if len(s.mStatInfo) > 0 {
147 s.reportAndClear("mStatInfo", true)
148 }
149 if len(s.mStatInfoFromServer) > 0 {
150 s.reportAndClear("mStatInfoFromServer", false)
151 }
152 }
153 }
154}
155
156func (s *StatFHelper) pushBackMsg(stStatInfo StatInfo, fromServer bool) {
157 if fromServer {

Callers 10

TestLogFunction · 0.45
initReportFunction · 0.45
TestHashNewFunction · 0.45
GoInstallFunction · 0.45
GoInstallFunction · 0.45
ModuleVersionFunction · 0.45
mainFunction · 0.45
TestSetMaxPackageLengthFunction · 0.45
TestKetamaHashAlg_HashFunction · 0.45

Calls 3

collectMsgMethod · 0.95
reportAndClearMethod · 0.95
ServerConfigMethod · 0.80

Tested by 5

TestLogFunction · 0.36
TestHashNewFunction · 0.36
TestSetMaxPackageLengthFunction · 0.36
TestKetamaHashAlg_HashFunction · 0.36