Fix(url-test): incorrect result
This commit is contained in:
parent
159d9da548
commit
bd0b6a2e40
1 changed files with 5 additions and 4 deletions
|
@ -106,12 +106,13 @@ func (u *URLTest) speedTest() {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
picker, ctx := picker.WithContext(ctx)
|
picker, ctx := picker.WithContext(ctx)
|
||||||
for _, p := range u.proxies {
|
for _, p := range u.proxies {
|
||||||
|
proxy := p
|
||||||
picker.Go(func() (interface{}, error) {
|
picker.Go(func() (interface{}, error) {
|
||||||
_, err := p.URLTest(ctx, u.rawURL)
|
t, err := proxy.URLTest(ctx, u.rawURL)
|
||||||
if err != nil {
|
if err != nil || t == 0 {
|
||||||
return nil, err
|
return nil, errors.New("speed test error")
|
||||||
}
|
}
|
||||||
return p, nil
|
return proxy, nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue