Skip to content

Commit

Permalink
Bug 1559114 - Optimize signature verification of Remote Settings dump…
Browse files Browse the repository at this point in the history
…s r=glasserc

Differential Revision: https://phabricator.services.mozilla.com/D34879

--HG--
extra : moz-landing-system : lando
  • Loading branch information
leplatrem committed Jun 18, 2019
1 parent 1d103e3 commit 31482b4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions services/settings/RemoteSettingsClient.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ class RemoteSettingsClient extends EventEmitter {
// The worker only returns an integer. List the imported records to build the sync event.
if (imported > 0) {
console.debug(`${this.identifier} ${imported} records loaded from JSON dump`);
({ data: importedFromDump } = await kintoCollection.list());
({ data: importedFromDump } = await kintoCollection.list({ order: "" }));
}
collectionLastModified = await kintoCollection.db.getLastModified();
} catch (e) {
Expand All @@ -333,7 +333,11 @@ class RemoteSettingsClient extends EventEmitter {
// we fetch them and validate the signature immediately.
if (this.verifySignature && ObjectUtils.isEmpty(await kintoCollection.metadata())) {
console.debug(`${this.identifier} verify signature of local data`);
const { data: allData } = await kintoCollection.list({ order: "" });
let allData = importedFromDump;
if (importedFromDump.length == 0) {
// If dump was imported at some other point (eg. `.get()`), list local DB.
({ data: allData } = await kintoCollection.list({ order: "" }));
}
const localRecords = allData.map(r => kintoCollection.cleanLocalFields(r));
const metadata = await kintoCollection.pullMetadata(this.httpClient());
if (this.verifySignature) {
Expand Down

0 comments on commit 31482b4

Please sign in to comment.