mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-23 00:38:33 +02:00
feat(health): add health check detail to health api
This commit is contained in:
@@ -65,6 +65,21 @@ func (w *Watcher) Status() health.Status {
|
||||
return health.StatusNapping
|
||||
}
|
||||
|
||||
// Detail implements health.HealthMonitor.
|
||||
func (w *Watcher) Detail() string {
|
||||
state := w.state.Load()
|
||||
if state.err != nil {
|
||||
return state.err.Error()
|
||||
}
|
||||
if !state.ready {
|
||||
return "not ready"
|
||||
}
|
||||
if state.status == idlewatcher.ContainerStatusRunning {
|
||||
return "starting"
|
||||
}
|
||||
return "napping"
|
||||
}
|
||||
|
||||
func checkUpdateState(key string) (w *Watcher, ready bool, err error) {
|
||||
watcherMapMu.RLock()
|
||||
w, ok := watcherMap[key]
|
||||
|
||||
Reference in New Issue
Block a user