mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Split multiple id deletes into 100-id chunks instead of hitting max apache URI length.
This commit is contained in:
parent
f56a03aa93
commit
3f44aa854b
@ -637,14 +637,26 @@ SyncEngine.prototype = {
|
||||
this._log.trace("Finishing up sync");
|
||||
this._tracker.resetScore();
|
||||
|
||||
let doDelete = Utils.bind2(this, function(key, val) {
|
||||
let coll = new Collection(this.engineURL, this._recordObj);
|
||||
coll[key] = val;
|
||||
coll.delete();
|
||||
});
|
||||
|
||||
for (let [key, val] in Iterator(this._delete)) {
|
||||
// Remove the key for future uses
|
||||
delete this._delete[key];
|
||||
|
||||
// Send a delete for the property
|
||||
let coll = new Collection(this.engineURL, this._recordObj);
|
||||
coll[key] = val;
|
||||
coll.delete();
|
||||
// Send a simple delete for the property
|
||||
if (key != "ids" || val.length <= 100)
|
||||
doDelete(key, val);
|
||||
else {
|
||||
// For many ids, split into chunks of at most 100
|
||||
while (val.length > 0) {
|
||||
doDelete(key, val.slice(0, 100));
|
||||
val = val.slice(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user