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

Method Load

internal/utils/agents/manager.go:91–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

89}
90
91func (this *Manager) Load() error {
92 var offset int64 = 0
93 var size int64 = 10000
94 for {
95 agentIPs, err := this.db.ListAgentIPs(offset, size)
96 if err != nil {
97 return err
98 }
99 if len(agentIPs) == 0 {
100 break
101 }
102 for _, agentIP := range agentIPs {
103 this.locker.Lock()
104 this.ipMap[agentIP.IP] = agentIP.AgentCode
105 this.locker.Unlock()
106
107 if agentIP.Id > this.lastId {
108 this.lastId = agentIP.Id
109 }
110 }
111 offset += size
112 }
113
114 return nil
115}
116
117func (this *Manager) LoopAll() error {
118 for {

Callers 2

StartMethod · 0.95
TestNewManagerFunction · 0.45

Calls 3

ListAgentIPsMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45

Tested by 1

TestNewManagerFunction · 0.36