mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-02-23 12:42:27 +08:00
Fix: incorrect use batch
This commit is contained in:
parent
aa9f8a39a3
commit
507ba16065
@ -59,14 +59,14 @@ func (hc *HealthCheck) touch() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (hc *HealthCheck) check() {
|
func (hc *HealthCheck) check() {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), defaultURLTestTimeout)
|
b := batch.New(batch.WithConcurrencyNum(10))
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
b, ctx := batch.WithContext(ctx, batch.WithConcurrencyNum(10))
|
|
||||||
for _, proxy := range hc.proxies {
|
for _, proxy := range hc.proxies {
|
||||||
p := proxy
|
p := proxy
|
||||||
b.Go(p.Name(), func() (interface{}, error) {
|
b.Go(p.Name(), func() (interface{}, error) {
|
||||||
return p.URLTest(ctx, hc.url)
|
ctx, cancel := context.WithTimeout(context.Background(), defaultURLTestTimeout)
|
||||||
|
defer cancel()
|
||||||
|
p.URLTest(ctx, hc.url)
|
||||||
|
return nil, nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
b.Wait()
|
b.Wait()
|
||||||
|
Loading…
Reference in New Issue
Block a user