chore: health check for compatible providers after startup

This commit is contained in:
Larvan2
2023-12-09 18:58:36 +08:00
parent 5a2ed71bd9
commit d80fcb77f6
3 changed files with 26 additions and 2 deletions

View File

@@ -104,7 +104,7 @@ func ParseProxyGroup(config map[string]any, proxyMap map[string]C.Proxy, provide
}
}
hc := provider.NewHealthCheck(ps, groupOption.URL, uint(groupOption.Interval), true, expectedStatus)
hc := provider.NewHealthCheck(ps, testUrl, uint(groupOption.Interval), groupOption.Lazy, expectedStatus)
pd, err := provider.NewCompatibleProvider(groupName, ps, hc)
if err != nil {

View File

@@ -252,6 +252,9 @@ func (cp *compatibleProvider) Update() error {
}
func (cp *compatibleProvider) Initial() error {
if cp.healthCheck.interval != 0 && cp.healthCheck.url != "" {
cp.HealthCheck()
}
return nil
}