Skip to content

Commit

Permalink
fix a agent core bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xjxia committed Nov 21, 2024
1 parent de31916 commit 3b0a6ea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dbm-services/common/dbha/ha-module/agent/monitor_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type MonitorAgent struct {
//instances need to detect
DBInstance map[string]dbutil.DataBaseDetect
//cache for reported GM instances
ReportGMCache map[string]CachedHostInfo
ReportGMCache map[string]*CachedHostInfo
GMInstance map[string]*GMConnection
// config file
Conf *config.Config
Expand All @@ -67,6 +67,7 @@ func NewMonitorAgent(conf *config.Config, detectType string) (*MonitorAgent, err
LastFetchInsTime: time.Now(),
LastFetchGMTime: time.Now(),
GMInstance: map[string]*GMConnection{},
ReportGMCache: map[string]*CachedHostInfo{},
heartbeat: time.Now(),
Conf: conf,
CmDBClient: client.NewCmDBClient(&conf.DBConf.CMDB, conf.GetCloudId()),
Expand Down Expand Up @@ -388,7 +389,7 @@ func (a *MonitorAgent) ReportDetectInfoToGM(reporterInstance dbutil.DataBaseDete
} else {
isReported = true
gmIns.Mutex.Unlock()
a.ReportGMCache[ip] = CachedHostInfo{
a.ReportGMCache[ip] = &CachedHostInfo{
ReporterGMTime: time.Now(),
Ip: ip,
ExpireInterval: a.Conf.AgentConf.ReportInterval,
Expand Down

0 comments on commit 3b0a6ea

Please sign in to comment.