-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix FXIOS-9159 - Fix Firefox Suggest operations to avoid blocking. (…
…#20401) * Fix Firefox Suggest operations to avoid blocking. This commit: * Refactors `RustFirefoxSuggest` to use a pair of serial dispatch queues to execute blocking read and write operations on the underlying `SuggestStore`. Previously, these operations would block, because calling a blocking function from an actor method (whether isolated or not) does _not_ automatically execute that function on a "global concurrent executor"; it can starve the calling thread. * Adopts the new `SuggestStore.interrupt(kind:)` API to implement `RustFirefoxSuggest.interruptEverything()`, which interrupts all ongoing operations. * Adds an expiration handler for the background ingestion task that calls `interruptEverything()`. * Make `RustFirefoxSuggest` a class, not an actor. Isolated methods on an actor are serialized, to protect the actor's mutable state. This is undesired for `RustFirefoxSuggest`, because it doesn't have any mutable state, and uses GCD queues to run read and write operations concurrently and off-main-thread. Using an actor here would serialize these operations, because isolated methods can't run concurrently. Instead, we can make `RustFirefoxSuggest` a regular class, and use `withCheckedThrowingContinuation` to expose an `await`-compatible API.
- Loading branch information
1 parent
2cb2565
commit 0a84b6a
Showing
5 changed files
with
58 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters