fix(measurex): allow API user to choose parallelism (#581)

Closes https://github.com/ooni/probe/issues/1818
This commit is contained in:
Simone Basso 2021-11-05 14:37:03 +01:00 committed by GitHub
commit ba7b981fcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 88 additions and 34 deletions

View file

@ -88,9 +88,14 @@ func main() {
//
// - all the endpoints to measure
//
// The parallelism argument tells the code how many parallel goroutines
// to use for parallelizable operations. If this value is zero or negative,
// the code will use a reasonably small default.
//
// ```Go
cookies := measurex.NewCookieJar()
for epnt := range mx.HTTPEndpointGetParallel(ctx, cookies, httpEndpoints...) {
const parallelism = 3
for epnt := range mx.HTTPEndpointGetParallel(ctx, parallelism, cookies, httpEndpoints...) {
m.Endpoints = append(m.Endpoints, epnt)
}
// ```