mirror of
https://github.com/yusing/godoxy.git
synced 2025-06-06 11:42:34 +02:00
fix(route): incorrect health status for idlewatcher dependencies
This commit is contained in:
parent
9470a14fe8
commit
d240da4393
3 changed files with 10 additions and 2 deletions
|
@ -69,8 +69,6 @@ type (
|
|||
|
||||
const ContextKey = "idlewatcher.watcher"
|
||||
|
||||
// TODO: replace -1 with neverTick
|
||||
|
||||
var (
|
||||
watcherMap = make(map[string]*Watcher)
|
||||
watcherMapMu sync.RWMutex
|
||||
|
@ -315,6 +313,8 @@ func NewWatcher(parent task.Parent, r routes.Route, cfg *idlewatcher.Config) (*W
|
|||
|
||||
w.dedupDependencies()
|
||||
|
||||
r.SetHealthMonitor(w)
|
||||
|
||||
w.l = w.l.With().Strs("deps", cfg.DependsOn).Logger()
|
||||
if exists {
|
||||
w.l.Debug().Msg("idlewatcher reloaded")
|
||||
|
|
|
@ -366,6 +366,13 @@ func (r *Route) HealthMonitor() health.HealthMonitor {
|
|||
return r.HealthMon
|
||||
}
|
||||
|
||||
func (r *Route) SetHealthMonitor(m health.HealthMonitor) {
|
||||
if r.HealthMon != nil && r.HealthMon != m {
|
||||
r.HealthMon.Finish("health monitor replaced")
|
||||
}
|
||||
r.HealthMon = m
|
||||
}
|
||||
|
||||
func (r *Route) IdlewatcherConfig() *idlewatcher.Config {
|
||||
return r.Idlewatcher
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ type (
|
|||
GetProvider() Provider
|
||||
TargetURL() *net.URL
|
||||
HealthMonitor() health.HealthMonitor
|
||||
SetHealthMonitor(m health.HealthMonitor)
|
||||
References() []string
|
||||
|
||||
Started() <-chan struct{}
|
||||
|
|
Loading…
Add table
Reference in a new issue