Use JSONFile.jsm to write Sync metadata files

RESOLVED FIXED in Firefox 58

Status

()

enhancement
P1
normal
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: lina, Assigned: lina)

Tracking

unspecified
Firefox 58
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox58 fixed)

Details

Attachments

(1 attachment)

We currently use JSONFile for the trackers, and we also persist outgoing commands, IDs to fetch, failed IDs, and add-ons reconciler state to disk. These don't register shutdown blockers, and `toFetch` and `failed` operate on a timer.

It's possible to lose data on shutdown, which might be OK for these cases, but let's make sure. If we want more durable storage, let's switch to JSONFile.jsm.
Priority: -- → P3
See Also: → 1405833
Priority: P3 → P2
Assignee: nobody → kit
Status: NEW → ASSIGNED
Depends on: 1368209
Priority: P2 → P1
I didn't convert the clients engine or add-ons reconciler to use `JSONFile` here. That's good fodder for a follow-up, or we can leave them be. The clients engine might benefit from a shutdown blocker.
Comment on attachment 8924818 [details]
Bug 1366067 - Use `JSONFile.jsm` to persist the backlog and previously failed IDs.

https://reviewboard.mozilla.org/r/196050/#review201564

I'm not completely familiar with the JSONFile API, but this looks good to me!

::: services/sync/modules/engines.js:100
(Diff revision 1)
>    _dataPostProcessor(json) {
>      return typeof json == "object" && json || {};
>    },
>  
>    // Ensure the Weave storage directory exists before writing the file.
>    _beforeSave() {

Do we still need this function?
Attachment #8924818 - Flags: review?(tchiovoloni) → review+
Comment on attachment 8924818 [details]
Bug 1366067 - Use `JSONFile.jsm` to persist the backlog and previously failed IDs.

https://reviewboard.mozilla.org/r/196050/#review201564

> Do we still need this function?

I think we do; `test_engine` tests the tracker separately, and we create `weave/changes/` separately from `weave/toFetch/` and `weave/failed`.
Pushed by kcambridge@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/66a726c06aa7
Use `JSONFile.jsm` to persist the backlog and previously failed IDs. r=tcsc
https://hg.mozilla.org/mozilla-central/rev/66a726c06aa7
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 58
You need to log in before you can comment on or make changes to this bug.