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

Method recover

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

Source from the content-addressed store, hash-verified

250}
251
252func (this *DAUManager) recover() error {
253 data, err := os.ReadFile(this.cacheFile)
254 if err != nil || len(data) == 0 {
255 return err
256 }
257
258 _ = os.Remove(this.cacheFile)
259
260 var statMap = map[string]int64{}
261 err = json.Unmarshal(data, &statMap)
262 if err != nil {
263 return err
264 }
265
266 var today = timeutil.Format("Ymd")
267 for key := range statMap {
268 var pieces = strings.Split(key, "_")
269 if pieces[1] != today {
270 delete(statMap, key)
271 }
272 }
273 this.statMap = statMap
274 return nil
275}

Callers 1

InitMethod · 0.95

Calls 2

RemoveMethod · 0.65
FormatMethod · 0.65

Tested by

no test coverage detected