fix(measurex): allow API user to choose parallelism (#581)
Closes https://github.com/ooni/probe/issues/1818
This commit is contained in:
@@ -90,7 +90,8 @@ scheme is "https". Otherwise, if it's just "http", it
|
||||
does not make sense to send this query.
|
||||
|
||||
```Go
|
||||
for dns := range mx.LookupURLHostParallel(ctx, parsed, resolvers...) {
|
||||
const parallelism = 3
|
||||
for dns := range mx.LookupURLHostParallel(ctx, parallelism, parsed, resolvers...) {
|
||||
m.DNS = append(m.DNS, dns)
|
||||
}
|
||||
```
|
||||
@@ -102,7 +103,7 @@ The rest of the program is exactly like in chapter09.
|
||||
httpEndpoints, err := measurex.AllHTTPEndpointsForURL(parsed, headers, m.DNS...)
|
||||
runtimex.PanicOnError(err, "cannot get all the HTTP endpoints")
|
||||
cookies := measurex.NewCookieJar()
|
||||
for epnt := range mx.HTTPEndpointGetParallel(ctx, cookies, httpEndpoints...) {
|
||||
for epnt := range mx.HTTPEndpointGetParallel(ctx, parallelism, cookies, httpEndpoints...) {
|
||||
m.Endpoints = append(m.Endpoints, epnt)
|
||||
}
|
||||
print(m)
|
||||
|
||||
@@ -91,7 +91,8 @@ func main() {
|
||||
// does not make sense to send this query.
|
||||
//
|
||||
// ```Go
|
||||
for dns := range mx.LookupURLHostParallel(ctx, parsed, resolvers...) {
|
||||
const parallelism = 3
|
||||
for dns := range mx.LookupURLHostParallel(ctx, parallelism, parsed, resolvers...) {
|
||||
m.DNS = append(m.DNS, dns)
|
||||
}
|
||||
// ```
|
||||
@@ -103,7 +104,7 @@ func main() {
|
||||
httpEndpoints, err := measurex.AllHTTPEndpointsForURL(parsed, headers, m.DNS...)
|
||||
runtimex.PanicOnError(err, "cannot get all the HTTP endpoints")
|
||||
cookies := measurex.NewCookieJar()
|
||||
for epnt := range mx.HTTPEndpointGetParallel(ctx, cookies, httpEndpoints...) {
|
||||
for epnt := range mx.HTTPEndpointGetParallel(ctx, parallelism, cookies, httpEndpoints...) {
|
||||
m.Endpoints = append(m.Endpoints, epnt)
|
||||
}
|
||||
print(m)
|
||||
|
||||
Reference in New Issue
Block a user