Repository navigation
Process Settings notifications off the posting thread (#58978) - #58978
Open
Abbondanzo wants to merge 1 commit into
Open
Abbondanzo wants to merge 1 commit into
Abbondanzo wants to merge 1 commit into
Conversation
|
@Abbondanzo has exported this pull request. If you are a Meta employee, you can view the originating Diff in D124504338. |
Summary: `SettingsManager` cleans the entire user-defaults dictionary inline whenever a defaults change notification arrives. A write on the main thread therefore performs unrelated, potentially expensive work before returning. Put the asynchronous update path behind a default-off runtime gate. With the gate off, preserve synchronous snapshot cleaning and event delivery, every intermediate update, the default module queue, and the existing lifecycle registration. With the gate on, process notifications on a dedicated serial background method queue. Coalesce pending notifications to the latest defaults state, while allowing a notification during a snapshot to schedule a trailing update. Keep JavaScript mutations on the same queue and suppress their notifications at posting time. Drop queued work after invalidation without blocking teardown or retaining the module. The `settingsUpdated` event name and full JSON-cleaned payload remain unchanged. Enabled-mode rapid external changes may be reported as one latest-state update rather than separate intermediate transitions. Synchronous constants export is unchanged. Changelog: [iOS][Fixed] - Add an opt-in asynchronous Settings update path to avoid blocking user-defaults writers Differential Revision: D124504338
Abbondanzo
force-pushed
the
export-D124504338
branch
from
October 10, 2026 04:55
8608281 to
06faaaa
Compare
This branch has not been deployed
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.
Summary:
SettingsManagercleans the entire user-defaults dictionary inline whenever a defaults change notification arrives. A write on the main thread therefore performs unrelated, potentially expensive work before returning.Put the asynchronous update path behind a default-off runtime gate. With the gate off, preserve synchronous snapshot cleaning and event delivery, every intermediate update, the default module queue, and the existing lifecycle registration.
With the gate on, process notifications on a dedicated serial background method queue. Coalesce pending notifications to the latest defaults state, while allowing a notification during a snapshot to schedule a trailing update. Keep JavaScript mutations on the same queue and suppress their notifications at posting time. Drop queued work after invalidation without blocking teardown or retaining the module.
The
settingsUpdatedevent name and full JSON-cleaned payload remain unchanged. Enabled-mode rapid external changes may be reported as one latest-state update rather than separate intermediate transitions. Synchronous constants export is unchanged.Changelog:
[iOS][Fixed] - Add an opt-in asynchronous Settings update path to avoid blocking user-defaults writers
Differential Revision: D124504338