MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / Close

Method Close

internal/stats/dau_manager.go:208–226  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

206}
207
208func (this *DAUManager) Close() error {
209 this.cleanTicker.Stop()
210
211 this.statLocker.Lock()
212 var statMap = this.statMap
213 this.statMap = map[string]int64{}
214 this.statLocker.Unlock()
215
216 if len(statMap) == 0 {
217 return nil
218 }
219
220 statJSON, err := json.Marshal(statMap)
221 if err != nil {
222 return err
223 }
224
225 return os.WriteFile(this.cacheFile, statJSON, 0666)
226}
227
228func (this *DAUManager) CleanStats() error {
229 if !this.isReady {

Callers 1

InitMethod · 0.95

Calls 4

WriteFileMethod · 0.80
StopMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected