mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1435588 - (part 1) Avoid inserting records one at a time when using the sync bookmark buffer r=kitcambridge
MozReview-Commit-ID: 6xRhLrrqVok --HG-- extra : rebase_source : 31757c405b1b16ace6103d39133cc2dfc6df11c8
This commit is contained in:
parent
f1008517f2
commit
8d161b9820
@ -1076,6 +1076,9 @@ BufferedBookmarksStore.prototype = {
|
||||
__proto__: BaseBookmarksStore.prototype,
|
||||
_openMirrorPromise: null,
|
||||
|
||||
// For tests.
|
||||
_batchChunkSize: 500,
|
||||
|
||||
ensureOpenMirror() {
|
||||
if (!this._openMirrorPromise) {
|
||||
this._openMirrorPromise = this._openMirror().catch(err => {
|
||||
@ -1105,6 +1108,15 @@ BufferedBookmarksStore.prototype = {
|
||||
});
|
||||
},
|
||||
|
||||
async applyIncomingBatch(records) {
|
||||
let buf = await this.ensureOpenMirror();
|
||||
for (let chunk of PlacesSyncUtils.chunkArray(records, this._batchChunkSize)) {
|
||||
await buf.store(chunk);
|
||||
}
|
||||
// Array of failed records.
|
||||
return [];
|
||||
},
|
||||
|
||||
async applyIncoming(record) {
|
||||
let buf = await this.ensureOpenMirror();
|
||||
await buf.store([record]);
|
||||
|
Loading…
Reference in New Issue
Block a user