Skip to content

Commit

Permalink
collector: unconditionally write the ReportID (#104)
Browse files Browse the repository at this point in the history
* collector: unconditionally write the ReportID

Issue reported by @FedericoCeratto

* Update mkevent.go
  • Loading branch information
bassosimone authored Nov 12, 2019
1 parent 66e81e9 commit f6fa6da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,14 @@ type updateResponse struct {
}

// SubmitMeasurement submits a measurement belonging to the report
// to the OONI collector. On success, we will modify the measurement
// updating its ReportID field. If the collector supports sending back to
// us a measurement ID, we also update the m.OOID field with it.
// to the OONI collector. We will unconditionally modify the measurement
// with the ReportID it should contain. If the collector supports sending
// back to us a measurement ID, we also update the m.OOID field with it.
func (r *Report) SubmitMeasurement(
ctx context.Context, m *model.Measurement,
) error {
var updateResponse updateResponse
m.ReportID = r.ID
err := (&jsonapi.Client{
BaseURL: r.client.BaseURL,
HTTPClient: r.client.HTTPClient,
Expand All @@ -143,7 +144,6 @@ func (r *Report) SubmitMeasurement(
}, &updateResponse,
)
if err == nil {
m.ReportID = r.ID
m.OOID = updateResponse.ID
}
return err
Expand Down
2 changes: 1 addition & 1 deletion experiment/mkevent/mkevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func Handle(
) {
if event.Key == "measurement" {
// We reparse the measurement and overwrite it. This is how we manage to
// return the measurement to the caller. Seriousy.
// return the measurement to the caller. Seriously.
//
// We panic if we cannot parse because since MK v0.9.0 the vendored
// nlohmann/json library should throw if passed non UTF-8 input.
Expand Down

0 comments on commit f6fa6da

Please sign in to comment.