[forwardport] fix(dnscheck): stop emitting progress (#785)

This diff forward ports b606494db8a9293384efaf5c33a88601f6e1e2a6
to the main development branch.

Dnscheck is emitting progress and the experiment controller is
also emitting progress. This messes up the progress bar.

See https://github.com/ooni/probe/issues/2058#issuecomment-1141638067
This commit is contained in:
Simone Basso 2022-06-02 09:31:52 +02:00 committed by GitHub
parent b58cfadb39
commit 2556e93050
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -225,7 +225,7 @@ func (m *Measurer) Run(
} }
// 8. perform all the required resolutions // 8. perform all the required resolutions
for output := range Collect(ctx, multi, inputs, callbacks) { for output := range Collect(ctx, multi, inputs, sess.Logger()) {
resolverURL := output.Input.Config.ResolverURL resolverURL := output.Input.Config.ResolverURL
tk.Lookups[resolverURL] = output.TestKeys tk.Lookups[resolverURL] = output.TestKeys
m.Endpoints.maybeRegister(resolverURL) m.Endpoints.maybeRegister(resolverURL)
@ -259,7 +259,7 @@ func (m *Measurer) tlsServerName(tlsServerName string) string {
// Collect prints on the output channel the result of running dnscheck // Collect prints on the output channel the result of running dnscheck
// on every provided input. It closes the output channel when done. // on every provided input. It closes the output channel when done.
func Collect(ctx context.Context, multi urlgetter.Multi, inputs []urlgetter.MultiInput, func Collect(ctx context.Context, multi urlgetter.Multi, inputs []urlgetter.MultiInput,
callbacks model.ExperimentCallbacks) <-chan urlgetter.MultiOutput { logger model.Logger) <-chan urlgetter.MultiOutput {
outputch := make(chan urlgetter.MultiOutput) outputch := make(chan urlgetter.MultiOutput)
expect := len(inputs) expect := len(inputs)
inputch := multi.Run(ctx, inputs) inputch := multi.Run(ctx, inputs)
@ -269,10 +269,8 @@ func Collect(ctx context.Context, multi urlgetter.Multi, inputs []urlgetter.Mult
for count < expect { for count < expect {
entry := <-inputch entry := <-inputch
count++ count++
percentage := float64(count) / float64(expect) logger.Infof("dnscheck: measure %s: %+v", entry.Input.Config.ResolverURL,
callbacks.OnProgress(percentage, fmt.Sprintf( model.ErrorToStringOrOK(entry.Err))
"dnscheck: measure %s: %+v", entry.Input.Config.ResolverURL, model.ErrorToStringOrOK(entry.Err),
))
outputch <- entry outputch <- entry
} }
}() }()