fix(geolocate): enforce 7s timeout for each lookupper (#678)
This issue aims at making life slighly better for users impacted by sanctions whose iplookup may be quite slow in case there are timeouts as documented in https://github.com/ooni/probe/issues/1988.
This commit is contained in:
parent
f7fd29b246
commit
024de0e498
|
@ -91,6 +91,10 @@ func makeSlice() []method {
|
|||
func (c ipLookupClient) doWithCustomFunc(
|
||||
ctx context.Context, fn lookupFunc,
|
||||
) (string, error) {
|
||||
// Reliability fix: let these mechanisms timeout earlier.
|
||||
const timeout = 7 * time.Second
|
||||
ctx, cancel := context.WithTimeout(ctx, timeout)
|
||||
defer cancel()
|
||||
// Implementation note: we MUST use an HTTP client that we're
|
||||
// sure IS NOT using any proxy. To this end, we construct a
|
||||
// client ourself that we know is not proxied.
|
||||
|
|
Loading…
Reference in New Issue
Block a user