Bug 1414438 - Use `getBatched` instead of `get` to backfill records r=kitcambridge
authortfe <tfeserver@gmail.com>
Wed, 08 Nov 2017 09:05:11 +0100
changeset 444119 e794bc60c010ab925f85ccec7a6ce19543cfa482
parent 444118 27ca9370036f9f0a39203073201e13918064cf75
child 444120 77d2425c4b40307d8a34fa8f6d52a8e16971e71f
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskitcambridge
bugs1414438
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1414438 - Use `getBatched` instead of `get` to backfill records r=kitcambridge MozReview-Commit-ID: LLTg0ae5BbW *** Bug 1414438 - Use `getBatched` instead of `get` in sync
services/sync/modules/engines.js
--- a/services/sync/modules/engines.js
+++ b/services/sync/modules/engines.js
@@ -1194,35 +1194,33 @@ SyncEngine.prototype = {
     // every subsequent sync just adds noise.
     this.previousFailed = failedInCurrentSync;
 
     let backfilledItems = this.itemSource();
 
     backfilledItems.sort = "newest";
     backfilledItems.full = true;
 
-    // `get` includes the list of IDs as a query parameter, so we need to fetch
+    // `getBatched` includes the list of IDs as a query parameter, so we need to fetch
     // records in chunks to avoid exceeding URI length limits.
     for (let ids of PlacesSyncUtils.chunkArray(idsToBackfill, this.guidFetchBatchSize)) {
       backfilledItems.ids = ids;
 
-      let resp = await backfilledItems.get();
-      if (!resp.success) {
-        resp.failureCode = ENGINE_DOWNLOAD_FAIL;
-        throw resp;
+      let {response, records} = await backfilledItems.getBatched(this.downloadBatchSize);
+      if (!response.success) {
+        response.failureCode = ENGINE_DOWNLOAD_FAIL;
+        throw response;
       }
 
       let maybeYield = Async.jankYielder();
       let backfilledRecordsToApply = [];
       let failedInBackfill = [];
 
-      for (let json of resp.obj) {
+      for (let record of records) {
         await maybeYield();
-        let record = new this._recordObj();
-        record.deserialize(json);
 
         let { shouldApply, error } = await this._maybeReconcile(record);
         if (error) {
           failedInBackfill.push(record.id);
           count.failed++;
           continue;
         }
         if (!shouldApply) {