mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-02-26 16:57:08 +00:00
chore: rebuild provider load
This commit is contained in:
@@ -43,13 +43,14 @@ type HealthCheck struct {
|
||||
}
|
||||
|
||||
func (hc *HealthCheck) process() {
|
||||
if hc.started.Load() {
|
||||
if !hc.started.CompareAndSwap(false, true) {
|
||||
log.Warnln("Skip start health check timer due to it's started")
|
||||
return
|
||||
}
|
||||
defer hc.started.Store(false)
|
||||
|
||||
ticker := time.NewTicker(hc.interval)
|
||||
hc.start()
|
||||
go hc.check()
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
@@ -62,7 +63,6 @@ func (hc *HealthCheck) process() {
|
||||
}
|
||||
case <-hc.ctx.Done():
|
||||
ticker.Stop()
|
||||
hc.stop()
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -131,14 +131,6 @@ func (hc *HealthCheck) touch() {
|
||||
hc.lastTouch.Store(time.Now())
|
||||
}
|
||||
|
||||
func (hc *HealthCheck) start() {
|
||||
hc.started.Store(true)
|
||||
}
|
||||
|
||||
func (hc *HealthCheck) stop() {
|
||||
hc.started.Store(false)
|
||||
}
|
||||
|
||||
func (hc *HealthCheck) check() {
|
||||
if len(hc.proxies) == 0 {
|
||||
return
|
||||
|
||||
@@ -302,9 +302,6 @@ func (cp *compatibleProvider) Update() error {
|
||||
}
|
||||
|
||||
func (cp *compatibleProvider) Initial() error {
|
||||
if cp.healthCheck.interval != 0 && cp.healthCheck.url != "" {
|
||||
cp.HealthCheck()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user