Fixed CR defects
This commit is contained in:
parent
10cc50ad29
commit
ce4d236a40
|
@ -47,6 +47,7 @@ func (r *CheckRunner) Start() {
|
|||
r.started = true
|
||||
}
|
||||
|
||||
// Started returns if the check runner has started running
|
||||
func (r *CheckRunner) Started() bool {
|
||||
r.startedLock.Lock()
|
||||
defer r.startedLock.Unlock()
|
||||
|
|
|
@ -687,16 +687,12 @@ func (c *Syncer) registerCheck(chkReg *consul.AgentCheckRegistration) error {
|
|||
return c.client.Agent().CheckRegister(chkReg)
|
||||
}
|
||||
|
||||
// ensureCheckRunning verifies that registerd check is in running state
|
||||
// ensureCheckRunning starts the check runner for a check if it's not already running
|
||||
func (c *Syncer) ensureCheckRunning(chk *consul.AgentCheckRegistration) {
|
||||
c.registryLock.RLock()
|
||||
defer c.registryLock.RUnlock()
|
||||
cr, ok := c.checkRunners[consulCheckID(chk.ID)]
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if !cr.Started() {
|
||||
c.logger.Printf("[DEBUG] ensureCheckRunning Running existing check. %v", chk)
|
||||
if cr, ok := c.checkRunners[consulCheckID(chk.ID)]; ok && !cr.Started() {
|
||||
c.logger.Printf("[DEBUG] consul.syncer: starting runner for existing check. %v", chk.ID)
|
||||
cr.Start()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue