-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug 1704606 - Rust: Don't return a result from submit_ping
#1613
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a sensible change. Even though this is not "really a breaking change", can we have a changelog entry? Just in case, to ease debugging in case future things go wrong somewhere! (no strong opinion, feel free to merge without)
(of course with CI passing) |
c0ad933
to
ca96c58
Compare
ca96c58
to
cdba52c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments, but nothing that should block this from landing if you file follow-ups
if let Err(err) = self.internal_pings.events.submit(self, Some("inactive")) { | ||
log::warn!("Failed to submit events ping on inactive: {}", err); | ||
if !self.internal_pings.events.submit(self, Some("inactive")) { | ||
log::info!("events ping not submitted on inactive"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it should still be louder than info!
, though, since it should be impossible. Thoughts? Maybe it needs instrumentation/error stream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not having an events ping on inactive is normal behavior though, if no events have been recorded nothing will be submitted.
c54697e
to
e2378d6
Compare
The `Result<bool>` value returned previously was not expressing what's really happening anymore. It was impossible to encounter an `Err` variant after recent changes. Technically this is a breaking change for glean-core, but that library is not consumed by any outsiders.
Unfortunately there's a left-over "DO NOT COMMIT" in there. Fix is pending upstream: mozilla/glean_parser#322
Submitting can't hard-fail anymore, so we can reduce our warning to info here.
This is required because of the changes made to ping.submit before and how it was used internally. Previously in event_database, when triggering startup event pings, we only checked if storing a ping did not fail. We did not check if any ping was actually submitted. So the code around it launched a task on the workmanager, which then subsequently checked and did nothing. The test ensured that, and triggering the work manager was just fine because there _was_ a pending task. With the changes we now return `true` if any ping was submitted. Or `false` if no event ping was submitted on startup. Now on startup no task was triggered and thus no workmanager can be triggered. That made the test fail because `triggerWorkManager` requires a task to be enqueued. We can force a task by also recording into the builtin "events" ping. It's a small hack, but allows us to test that late-registered pings with events are correctly skipped AND their events are deleted.
e2378d6
to
e652433
Compare
Codecov Report
@@ Coverage Diff @@
## main #1613 +/- ##
=======================================
Coverage 30.30% 30.30%
=======================================
Files 1 1
Lines 33 33
=======================================
Hits 10 10
Misses 23 23 Continue to review full report at Codecov.
|
The
Result<bool>
value returned previously was not expressing what'sreally happening anymore.
It was impossible to encounter an
Err
variant after recent changes.Technically this is a breaking change for glean-core, but that library
is not consumed by any outsiders.