Fix: incorrect use batch
This commit is contained in:
parent
b29ea418cb
commit
4e38de95f2
1 changed files with 5 additions and 5 deletions
|
@ -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 a new issue