refactor: pass experiment arguments using a struct (#983)

Closes https://github.com/ooni/probe/issues/2358.
This commit is contained in:
Simone Basso 2022-11-22 10:43:47 +01:00 committed by GitHub
commit a0dc65641d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 824 additions and 481 deletions

View file

@ -40,11 +40,13 @@ func (m *Measurer) ExperimentVersion() string {
}
// Run implements model.ExperimentMeasurer.
func (m *Measurer) Run(ctx context.Context, sess model.ExperimentSession,
measurement *model.Measurement, callbacks model.ExperimentCallbacks) error {
func (m *Measurer) Run(ctx context.Context, args *model.ExperimentArgs) error {
// Reminder: when this function returns an error, the measurement result
// WILL NOT be submitted to the OONI backend. You SHOULD only return an error
// for fundamental errors (e.g., the input is invalid or missing).
_ = args.Callbacks
measurement := args.Measurement
sess := args.Session
// make sure we have a cancellable context such that we can stop any
// goroutine running in the background (e.g., priority.go's ones)