Skip to content

Commit

Permalink
[forwardport] fix(dnscheck): stop emitting progress (#785)
Browse files Browse the repository at this point in the history
This diff forward ports b606494
to the main development branch.

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

See ooni/probe#2058 (comment)
  • Loading branch information
bassosimone authored Jun 2, 2022
1 parent b58cfad commit 2556e93
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions internal/engine/experiment/dnscheck/dnscheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func (m *Measurer) Run(
}

// 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
tk.Lookups[resolverURL] = output.TestKeys
m.Endpoints.maybeRegister(resolverURL)
Expand Down Expand Up @@ -259,7 +259,7 @@ func (m *Measurer) tlsServerName(tlsServerName string) string {
// Collect prints on the output channel the result of running dnscheck
// on every provided input. It closes the output channel when done.
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)
expect := len(inputs)
inputch := multi.Run(ctx, inputs)
Expand All @@ -269,10 +269,8 @@ func Collect(ctx context.Context, multi urlgetter.Multi, inputs []urlgetter.Mult
for count < expect {
entry := <-inputch
count++
percentage := float64(count) / float64(expect)
callbacks.OnProgress(percentage, fmt.Sprintf(
"dnscheck: measure %s: %+v", entry.Input.Config.ResolverURL, model.ErrorToStringOrOK(entry.Err),
))
logger.Infof("dnscheck: measure %s: %+v", entry.Input.Config.ResolverURL,
model.ErrorToStringOrOK(entry.Err))
outputch <- entry
}
}()
Expand Down

0 comments on commit 2556e93

Please sign in to comment.