Skip to content

Commit

Permalink
[bugfix] Fix lastUpdate cache policy when information reporting of ag…
Browse files Browse the repository at this point in the history
…ent(#469)
  • Loading branch information
yangbinnnn authored and laiwei committed Oct 31, 2018
1 parent 0f78593 commit bef896a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions modules/hbs/cache/agents.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ package cache
// 提供http接口查询机器信息,排查重名机器的时候比较有用

import (
"github.com/open-falcon/falcon-plus/common/model"
"github.com/open-falcon/falcon-plus/modules/hbs/db"
"sync"
"time"

"github.com/open-falcon/falcon-plus/common/model"
"github.com/open-falcon/falcon-plus/modules/hbs/db"
)

type SafeAgents struct {
Expand All @@ -48,10 +49,12 @@ func (this *SafeAgents) Put(req *model.AgentReportRequest) {
agentInfo.ReportRequest.PluginVersion != req.PluginVersion {

db.UpdateAgent(val)
this.Lock()
this.M[req.Hostname] = val
this.Unlock()
}

// 更新hbs 时间
this.Lock()
this.M[req.Hostname] = val
this.Unlock()
}

func (this *SafeAgents) Get(hostname string) (*model.AgentUpdateInfo, bool) {
Expand Down

0 comments on commit bef896a

Please sign in to comment.