func (this *SafeAgents) Put(req *model.AgentReportRequest) { val := &model.AgentUpdateInfo{ LastUpdate: time.Now().Unix(), ReportRequest: req, } db.UpdateAgent(val) this.Lock() defer this.Unlock() this.M[req.Hostname] = val }
func (this *SafeAgents) Put(req *model.AgentReportRequest) { val := &model.AgentUpdateInfo{ LastUpdate: time.Now().Unix(), ReportRequest: req, } if g.Config().ExternalNodes == "" { db.UpdateAgent(val) } this.Lock() defer this.Unlock() this.M[req.Hostname] = val debug := g.Config().Debug if debug { log.Printf("[DEBUG][CACHE] agent.put : %v", this.M) } }