Closes #388: Run Rust FxA calls in single thread context #399
Conversation
Codecov Report
@@ Coverage Diff @@
## master #399 +/- ##
============================================
+ Coverage 73.39% 74.12% +0.73%
Complexity 738 738
============================================
Files 119 119
Lines 2935 2906 -29
Branches 411 398 -13
============================================
Hits 2154 2154
+ Misses 568 539 -29
Partials 213 213
Continue to review full report at Codecov.
|
|
This looks good to me. We have confined all FxA methods to run on a single thread (both the sync and the async ones). We need to figure out how to release this single thread when we don't need it anymore (to save memory). I've filed a follow-up issue for that: #402 |
|
@pocmo are you ok with this as well? I didn't find an easy way to release the thread on timeout. I filed a follow-up to dig deeper. |
|
Yes, looks good! |
|
From Slack discussion with Thom: instead of starting the new thread context and worrying about when to close it, the blocks inside the coroutines can be synchronized on the FxaClient instance. |
|
@thomcc I think this does it. Want to take another look? We can refactor this later to introduce |
|
Yeah seems good to me. I'd definitely prefer it if you reduced the duplication (since messing it up == memory unsafety), but if you'd rather do that in a follow up I can deal. |
|
@carolkng fixed the code duplication by adding the |
4974: Add library for P2P communication and sample app r=jonalmeida a=espertus Add library for P2P communication and sample app This adds `lib-nearby` on top of the Google Play Nearby API. The sample app `nearby-chat` uses it to create a chat application enabling communication between 2 devices. This is a better version of #4794 because it is a single commit. 5045: Bump rubyzip from 1.2.3 to 2.0.0 in /docs r=pocmo a=dependabot[bot] Bumps [rubyzip](https://github.com/rubyzip/rubyzip) from 1.2.3 to 2.0.0. <details> <summary>Release notes</summary> *Sourced from [rubyzip's releases](https://github.com/rubyzip/rubyzip/releases).* > ## v2.0.0 > Security > > - Default the `validate_entry_sizes` option to `true`, so that callers can trust an entry's reported size when using `extract` [#403](https://github-redirect.dependabot.com/rubyzip/rubyzip/pull/403) > - This option defaulted to `false` in 1.3.0 for backward compatibility, but it now defaults to `true`. If you are using an older version of ruby and can't yet upgrade to 2.x, you can still use 1.3.0 and set the option to `true`. > > Tooling / Documentation > > - Remove test files from the gem to avoid problems with antivirus detections on the test files [#405](https://github-redirect.dependabot.com/rubyzip/rubyzip/pull/405) / [#384](https://github-redirect.dependabot.com/rubyzip/rubyzip/issues/384) > - Drop support for unsupported ruby versions [#406](https://github-redirect.dependabot.com/rubyzip/rubyzip/pull/406) > > ## v1.3.0 > Security > > - Add `validate_entry_sizes` option so that callers can trust an entry's reported size when using `extract` [#403](https://github-redirect.dependabot.com/rubyzip/rubyzip/pull/403) > - This option defaults to `false` for backward compatibility in this release, but you are strongly encouraged to set it to `true`. It will default to `true` in rubyzip 2.0. > > New Feature > > - Add `add_stored` method to simplify adding entries without compression [#366](https://github-redirect.dependabot.com/rubyzip/rubyzip/pull/366) > > Tooling / Documentation > > - Add more gem metadata links [#402](https://github-redirect.dependabot.com/rubyzip/rubyzip/pull/402) > > ## v1.2.4 > - Do not rewrite zip files opened with `open_buffer` that have not changed [#360](https://github-redirect.dependabot.com/rubyzip/rubyzip/pull/360) > > Tooling / Documentation > > - Update `example_recursive.rb` in README [#397](https://github-redirect.dependabot.com/rubyzip/rubyzip/pull/397) > - Hold CI at `trusty` for now, automatically pick the latest ruby patch version, use rbx-4 and hold jruby at 9.1 [#399](https://github-redirect.dependabot.com/rubyzip/rubyzip/pull/399) </details> <details> <summary>Changelog</summary> *Sourced from [rubyzip's changelog](https://github.com/rubyzip/rubyzip/blob/master/Changelog.md).* > # 2.0.0 (2019-09-25) > > Security > > - Default the `validate_entry_sizes` option to `true`, so that callers can trust an entry's reported size when using `extract` [#403](https://github-redirect.dependabot.com/rubyzip/rubyzip/pull/403) > - This option defaulted to `false` in 1.3.0 for backward compatibility, but it now defaults to `true`. If you are using an older version of ruby and can't yet upgrade to 2.x, you can still use 1.3.0 and set the option to `true`. > > Tooling / Documentation > > - Remove test files from the gem to avoid problems with antivirus detections on the test files [#405](https://github-redirect.dependabot.com/rubyzip/rubyzip/pull/405) / [#384](https://github-redirect.dependabot.com/rubyzip/rubyzip/issues/384) > - Drop support for unsupported ruby versions [#406](https://github-redirect.dependabot.com/rubyzip/rubyzip/pull/406) > > # 1.3.0 (2019-09-25) > > Security > > - Add `validate_entry_sizes` option so that callers can trust an entry's reported size when using `extract` [#403](https://github-redirect.dependabot.com/rubyzip/rubyzip/pull/403) > - This option defaults to `false` for backward compatibility in this release, but you are strongly encouraged to set it to `true`. It will default to `true` in rubyzip 2.0. > > New Feature > > - Add `add_stored` method to simplify adding entries without compression [#366](https://github-redirect.dependabot.com/rubyzip/rubyzip/pull/366) > > Tooling / Documentation > > - Add more gem metadata links [#402](https://github-redirect.dependabot.com/rubyzip/rubyzip/pull/402) > > # 1.2.4 (2019-09-06) > > - Do not rewrite zip files opened with `open_buffer` that have not changed [#360](https://github-redirect.dependabot.com/rubyzip/rubyzip/pull/360) > > Tooling / Documentation > > - Update `example_recursive.rb` in README [#397](https://github-redirect.dependabot.com/rubyzip/rubyzip/pull/397) > - Hold CI at `trusty` for now, automatically pick the latest ruby patch version, use rbx-4 and hold jruby at 9.1 [#399](https://github-redirect.dependabot.com/rubyzip/rubyzip/pull/399) </details> <details> <summary>Commits</summary> - [`2825898`](rubyzip/rubyzip@2825898) Merge pull request [#408](https://github-redirect.dependabot.com/rubyzip/rubyzip/issues/408) from rubyzip/v2-0-0 - [`cb407b1`](rubyzip/rubyzip@cb407b1) Bump version to 2.0.0 - [`e1d9af6`](rubyzip/rubyzip@e1d9af6) Merge pull request [#406](https://github-redirect.dependabot.com/rubyzip/rubyzip/issues/406) from rubyzip/bump-supported-ruby - [`3641a96`](rubyzip/rubyzip@3641a96) Merge pull request [#405](https://github-redirect.dependabot.com/rubyzip/rubyzip/issues/405) from rubyzip/remove-test-files - [`e79d9ea`](rubyzip/rubyzip@e79d9ea) Merge pull request [#407](https://github-redirect.dependabot.com/rubyzip/rubyzip/issues/407) from rubyzip/v1-3-0 - [`7c65e1e`](rubyzip/rubyzip@7c65e1e) Bump version to 1.3.0 - [`d65fe7b`](rubyzip/rubyzip@d65fe7b) Merge pull request [#403](https://github-redirect.dependabot.com/rubyzip/rubyzip/issues/403) from rubyzip/check-size - [`35446f4`](rubyzip/rubyzip@35446f4) Drop old ruby and JDK versions from CI - [`74d4bec`](rubyzip/rubyzip@74d4bec) Remove test files from gem - [`97cb6ae`](rubyzip/rubyzip@97cb6ae) Warn when an entry size is invalid - Additional commits viewable in [compare view](rubyzip/rubyzip@v1.2.3...v2.0.0) </details> <br /> [](https://help.github.com/articles/configuring-automated-security-fixes) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) Co-authored-by: Ellen Spertus <ellen.spertus@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Creates an FxaClient-specific single thread context, then moves all launch calls and runBlocking calls (for non-async methods calling into the Rust library) into that context.
r? @csadilek @thomcc