Closed Bug 1509066 Opened Last year Closed Last year

Force synchronization when calling .get() with missing local data


(Firefox :: Remote Settings Client, defect, P1)




Firefox 65
Tracking Status
firefox65 --- fixed


(Reporter: leplatrem, Assigned: leplatrem)




(1 file)

Currently, we don't guarantee how soon the remote data will be available in new profiles.

A client that calls ``.get()`` early after startup is likely to obtain an empty list.

The same applies for a client that is registered at an arbitrary time (like pref flip). ``.get()`` will return an empty list until the next sync.

For that concern, we offer the ability to ship JSON dumps, that will be loaded into the local DB when ``.get()`` is called on a database that was not synchronized yet.

In some situations, like Bug 1506175, the remote data is so ephemeral that it does not make much sense to ship JSON dumps in mozilla-central. Yet, in this use-case, Normandy tries very hard to run as soon as possible during the first browser session and it would be bad if that first run never had any data.

If I remember well, when enabled, Megaphone will also kick a synchronization very soon after startup.

We should at least document what actually happens (timer execution policy, megaphone etc.), and if necessary, we could also introduce a ``forceSync`` option to ``.get()`` that would pull data from the server if the local DB was not yet synchronized.

Normandy will generally know when it needs data ASAP and when it doesn't, so having a parameter to force a sync (like `forceSync`) would work well for Normandy.

Another option would be to have Normandy do the initial sync via the old methods, pulling the full JSON from the server. It could then use that content for the as the initial JSON dump for the traditional system.
Priority: -- → P1
I think a `forceSync` option would be prone to abuse, so if we offer it, it should have some clear explanation of when it should and shouldn't be used and what the consequences are of it being used all the time. But I do think `forceSync` would be appropriate for Normandy.
I think the proper name should be `syncIfEmpty` or something similar. It should only synchronize if the local database is empty for that collection.
Since the `forceSync`/`syncIfEmpty` option would only be effective when the collection is already empty would it make sense to turn it on by default? I think most developers would be surprised that they have to wait up to 24 hours to get data after the first time calling `.get()`. Users that don't want that behavior could ship a JSON dump or pass `syncIfEmpty: false`. I think that, at least in my experience, the initial sync is the behavior that most people would expect.
Assignee: nobody → mathieu
Pushed by
Sync on RemoteSettings.get() when local db is empty r=glasserc
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → Firefox 65
You need to log in before you can comment on or make changes to this bug.