mirror of
https://github.com/yusing/godoxy.git
synced 2025-06-07 12:02: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"
|
const ContextKey = "idlewatcher.watcher"
|
||||||
|
|
||||||
// TODO: replace -1 with neverTick
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
watcherMap = make(map[string]*Watcher)
|
watcherMap = make(map[string]*Watcher)
|
||||||
watcherMapMu sync.RWMutex
|
watcherMapMu sync.RWMutex
|
||||||
|
@ -315,6 +313,8 @@ func NewWatcher(parent task.Parent, r routes.Route, cfg *idlewatcher.Config) (*W
|
||||||
|
|
||||||
w.dedupDependencies()
|
w.dedupDependencies()
|
||||||
|
|
||||||
|
r.SetHealthMonitor(w)
|
||||||
|
|
||||||
w.l = w.l.With().Strs("deps", cfg.DependsOn).Logger()
|
w.l = w.l.With().Strs("deps", cfg.DependsOn).Logger()
|
||||||
if exists {
|
if exists {
|
||||||
w.l.Debug().Msg("idlewatcher reloaded")
|
w.l.Debug().Msg("idlewatcher reloaded")
|
||||||
|
|
|
@ -366,6 +366,13 @@ func (r *Route) HealthMonitor() health.HealthMonitor {
|
||||||
return r.HealthMon
|
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 {
|
func (r *Route) IdlewatcherConfig() *idlewatcher.Config {
|
||||||
return r.Idlewatcher
|
return r.Idlewatcher
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ type (
|
||||||
GetProvider() Provider
|
GetProvider() Provider
|
||||||
TargetURL() *net.URL
|
TargetURL() *net.URL
|
||||||
HealthMonitor() health.HealthMonitor
|
HealthMonitor() health.HealthMonitor
|
||||||
|
SetHealthMonitor(m health.HealthMonitor)
|
||||||
References() []string
|
References() []string
|
||||||
|
|
||||||
Started() <-chan struct{}
|
Started() <-chan struct{}
|
||||||
|
|
Loading…
Add table
Reference in a new issue