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

Method processIP

internal/stats/dau_manager.go:156–185  ·  view source on GitHub ↗
(serverId int64, ip string)

Source from the content-addressed store, hash-verified

154}
155
156func (this *DAUManager) processIP(serverId int64, ip string) error {
157 if !this.isReady {
158 return nil
159 }
160
161 // day
162 var date = fasttime.Now().Ymd()
163
164 {
165 var key = "server_" + date + "_" + types.String(serverId) + "_" + ip
166 found, err := this.ipTable.Exist(key)
167 if err != nil || found {
168 return err
169 }
170
171 err = this.ipTable.Set(key, nil)
172 if err != nil {
173 return err
174 }
175 }
176
177 {
178 var key = "server_" + date + "_" + types.String(serverId)
179 this.statLocker.Lock()
180 this.statMap[key] = this.statMap[key] + 1
181 this.statLocker.Unlock()
182 }
183
184 return nil
185}
186
187func (this *DAUManager) ReadStatMap() map[string]int64 {
188 this.statLocker.Lock()

Callers 1

InitMethod · 0.95

Calls 7

NowFunction · 0.92
YmdMethod · 0.80
ExistMethod · 0.65
StringMethod · 0.45
SetMethod · 0.45
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected