Repository navigation
iOS: flush the core off the main thread under a background task - #141
Open
katulevskiy wants to merge 3 commits into
Open
katulevskiy wants to merge 3 commits into
katulevskiy wants to merge 3 commits into
Conversation
…tion didEnterBackground ran CoreClient.onBackground() inline on the main thread with no UIKit background-task assertion, so a slow flush blocked the scene callback and nothing kept iOS from suspending the process once it returned. The old SwiftUI app held a beginBackgroundTask around its flush; the UIKit rewrite dropped it. Run the lifecycle calls on a serial queue (so a quick foreground cannot overtake a running flush) and hold beginBackgroundTask until the flush is done; the expiration handler ends the task. The FFI surface is unchanged. The Rust side already skips clean state (Persister::flush returns when generation == saved; the registry flush is gated on registry_dirty), so no core change is needed. Pin that with a test, since backgrounding cost depends on it.
Source: zeronsh#624 Source revision: d4e5454
Contribution Managerneeds triage · medium risk · untriaged Open review workspace · Revision Next actions:
This summary is maintained by the review app. Decisions and test evidence are recorded in the workspace; the app does not merge PRs. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upstream mirror
Source: zeronsh#624
Original author: @katulevskiy
Original revision:
d4e5454f2cecdef93f13057a279260317ebedf3cThis PR is an isolated Contribution Manager pilot mirror. Its reviews, checks and merge state are separate from upstream. An empty
[skip ci]commit suppresses automatic bulk CI; the code tree matches the imported upstream revision.Summary
didEnterBackgroundcalledCoreClient.onBackground()inline on the main thread with no background task assertion. The old SwiftUI app held abeginBackgroundTaskaround its flush; the UIKit rewrite dropped it.beginBackgroundTask, ended when the flush finishes or in the expiration handler.willEnterForegroundrunsonForeground()on the same queue, so a quick return to the app can't overtake a running flush.Persister::flushreturns whengeneration == saved, and the registry flush is gated onregistry_dirty), so there is no core change. A new test pins that behaviour.willEnterForeground,refreshWorkspace()still runs immediately whileonForeground()is now queued. Before, the core call finished first. IfrefreshWorkspace()depends on it, that ordering needs another look.