-
Notifications
You must be signed in to change notification settings - Fork 474
Add SyncReason for engine requesting a sync #7119
Comments
Copying from the original issue, perhaps something like |
It would be nice if there was some kind of sync request builder. A data class of attributes even would make this a nicer way to programmatically build up a request of things until we want to "submit" it to the account manager. |
🤷 |
A builder might not be the best solution to the problem I'd like to solve, which the complexity of a all the configurations in one call. Being able to execute transactions on the account manager and letting it figure out how to handle the rest would make it easier as a consumer, somewhat similar to our accountManager.apply {
dispatch(AccountAction.RefreshDevices)
dispatch(AccountAction.UpdateEngine(Engine.SyncTabs)
dispatch(AccountAction.SyncNow(/*all the params you want*/))
} Having the account manager as a state object then would make it easier to observe the account changes, or (in the Sync Tabs case) only when the one engine data store changes and not have to consider all the other state changes that we need to get to the one. This is falling more into the territory of #6879 thought and is not a small fix that you're probably looking for. 🙂 |
I had a feeling you'll go this way :) The In practice our usages are:
Where do you see these requirements evolving, beyond this issue itself? Combined with the cases above, we'll cover quite a lot of ground already as far as product features go. The "sync" operation itself is the common denominator here, in practice we'd likely always want to sync in reaction to outside events. E.g. if user disables a history engine, we need to sync to propagate that change to other clients. One exception currently is "refresh devices while sharing a tab". In case of synced tabs what we really want is to know what we have both:
If our synced tabs API also included client info alongside the tabs (and not just the client ID), we could do away with a single API call, but as things stand they need to be resolved together. It'll be nice if the public API here was aware of this - if you ask for a sync and request a client refresh, we consider that to be complete (e.g. "idle" callback is called) once both sync is complete and client list is refreshed. Now that I've typed this, I think it's a good direction to follow - consider the end-to-end use cases we care about, not just entry points into the API, and make the common ones easy and without foot guns. |
As long as this is a part of our consideration, I'm fine with any direction we go. :) As a consumer of the API, the ergonomics and extensibility are what I focus on. I'll continue the other parts of my discussion in the other ticket as they come by. |
Moved to bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1794208 Change performed by the Move to Bugzilla add-on. |
Based on: #7114 (comment)
Features/engines may want to request a sync before performing an action. We don't have a good
SyncReason
to indicate the difference between a user-initiated action and a programmatic one.Similarly, we do not know which sync engines are requesting a sync the most. This would help with telemetry on usage patterns.
cc: @grigoryk
┆Issue is synchronized with this Jira Task
The text was updated successfully, but these errors were encountered: