Commit e17343d8 authored by Chelsea Holland Komlo's avatar Chelsea Holland Komlo
Browse files

set driver to unhealthy once if it cannot be detected in periodic check

parent 179db0df
Showing with 14 additions and 0 deletions
+14 -0
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: detected,
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()
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment