set driver to unhealthy once if it cannot be detected in periodic check
This commit is contained in:
parent
5df4b3728d
commit
bbaffe3eca
|
@ -1,6 +1,7 @@
|
|||
package client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"strings"
|
||||
"sync"
|
||||
|
@ -308,6 +309,19 @@ func (fm *FingerprintManager) watchDriver(d driver.Driver, name string) {
|
|||
if err := fm.runDriverHealthCheck(name, hc); err != nil {
|
||||
fm.logger.Printf("[DEBUG] client.fingerprint_manager: health checking for %v failed: %v", name, err)
|
||||
}
|
||||
} else {
|
||||
// If the driver is undetected, change the health status to unhealthy
|
||||
// only once.
|
||||
healthInfo := &structs.DriverInfo{
|
||||
Healthy: false,
|
||||
HealthDescription: fmt.Sprintf("Driver %s is not detected", name),
|
||||
UpdateTime: time.Now(),
|
||||
}
|
||||
if node := fm.updateNodeFromDriver(name, nil, healthInfo); node != nil {
|
||||
fm.nodeLock.Lock()
|
||||
fm.node = node
|
||||
fm.nodeLock.Unlock()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue