Closed
Bug 1344737
Opened 9 years ago
Closed 9 years ago
Update TelemetrySession.jsm to async function & await
Categories
(Toolkit :: Telemetry, enhancement, P4)
Toolkit
Telemetry
Tracking
()
RESOLVED
FIXED
mozilla55
| Tracking | Status | |
|---|---|---|
| firefox55 | --- | fixed |
People
(Reporter: gfritzsche, Assigned: djmdeveloper060796, Mentored)
References
Details
(Whiteboard: [measurement:client] [lang=js])
Attachments
(1 file)
|
4.14 KB,
patch
|
chutten
:
review+
|
Details | Diff | Splinter Review |
We have `async function` and `await` now:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function
We should be able to replace:
- `Task.async(function*(...))`, `Task.spawn(function*(...))` with a form of `async function ...`
- `yield` with `await` in the changed functions
https://dxr.mozilla.org/mozilla-central/search?q=path%3ATelemetrySession.jsm+Task.+yield&redirect=false
The only case i can think of that doesn't migrate trivially is any `DeferredTask` usage, we could just leave those for now.
| Reporter | ||
Comment 1•9 years ago
|
||
Comment 2•9 years ago
|
||
@Georg I would like to work on this. I've read the code and doc of async function. Can you let me know how to proceed further?
| Assignee | ||
Comment 3•9 years ago
|
||
Updated TelemetrySession.jsm to async and await.
Attachment #8846390 -
Flags: review?(gfritzsche)
| Reporter | ||
Updated•9 years ago
|
Assignee: nobody → djmdeveloper060796
| Reporter | ||
Comment 4•9 years ago
|
||
Comment on attachment 8846390 [details] [diff] [review]
bug1344737.patch
I'm short on time, redirecting request.
Attachment #8846390 -
Flags: review?(gfritzsche) → review?(alessio.placitelli)
Updated•9 years ago
|
Flags: needinfo?(chutten)
Attachment #8846390 -
Flags: review?(alessio.placitelli) → review?(chutten)
Comment 6•9 years ago
|
||
Comment on attachment 8846390 [details] [diff] [review]
bug1344737.patch
Review of attachment 8846390 [details] [diff] [review]:
-----------------------------------------------------------------
Thank you for your patch!
Have you run the telemetry tests with this patch? From your mozilla-central root, run mach test toolkit/components/telemetry/tests/unit/. It appears as though you may have changed all of the `yield` to `await` where you instead should have only changed the ones next to functions that you changed from `Task.*` to `async function`.
::: toolkit/components/telemetry/TelemetrySession.jsm
@@ +1532,3 @@
> // Update the session data to keep track of new subsessions created before
> // the initialization.
> + await TelemetryStorage.saveSessionData(this._getSessionDataObject());
If the TelemetryStorage function has not been updated to async, this won't play nicely, I don't think. Best to leave this untouched and let bug 1344743 take care of making this change.
@@ +1543,4 @@
> Telemetry.asyncFetchTelemetryData(function() {});
>
> // Update the crash annotation with the proper client ID.
> + annotateCrashReport(this._sessionId, await ClientID.getClientID(),
If ClientID hasn't been updated to async function, then await won't work.
@@ +2044,4 @@
> * @return {Promise<object>} A promise which is resolved with an object when
> * loading has completed, with null otherwise.
> */
> + async _loadSessionData() {
Is this valid syntax?
Attachment #8846390 -
Flags: review?(chutten)
| Assignee | ||
Comment 7•9 years ago
|
||
@Chris I have run unit tests from mozilla-central root, all the tests are passing
I had to use short hand notation for async function as otherwise I was getting esling error :
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions#Shorthand_async_methods
Flags: needinfo?(chutten)
Comment 8•9 years ago
|
||
Interesting. I wonder if it all works because of the format of the Promises returned by those embedded functions.
Let me throw this up on try (our build+test farm) and see if it can find any holes in it. Clearly I need more experience with these new asynchronous features :S
The try build will progress here: https://treeherder.mozilla.org/#/jobs?repo=try&revision=7d73689619fa643de119775d06f91d92ac429b49
If it can't find anything, then it'll be an r+ and a checkin-needed from me.
Flags: needinfo?(chutten)
Comment 9•9 years ago
|
||
Comment on attachment 8846390 [details] [diff] [review]
bug1344737.patch
Review of attachment 8846390 [details] [diff] [review]:
-----------------------------------------------------------------
try's green, and I have some reading to do so I can learn why :S
Attachment #8846390 -
Flags: review+
Comment 11•9 years ago
|
||
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d762468d4657
Update TelemetrySession.jsm to async function & await. r=chutten
Keywords: checkin-needed
Comment 12•9 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Updated•8 years ago
|
status-firefox54:
affected → ---
You need to log in
before you can comment on or make changes to this bug.
Description
•