Bug 1415012 - Don't trigger a resync if the previous sync wasn't completely successful r=kitcambridge

MozReview-Commit-ID: DcNsFUxXR1O

--HG--
extra : rebase_source : 2632aa8d6db8e9e101e949c237b559015444f808
This commit is contained in:
Thom Chiovoloni 2017-11-06 20:56:57 -05:00
parent 91504c0900
commit edeaf1bc14
2 changed files with 32 additions and 1 deletions

View File

@ -175,7 +175,7 @@ SyncScheduler.prototype = {
let sync_interval;
this.updateGlobalScore();
if (this.globalScore > 0) {
if (this.globalScore > 0 && Status.service == STATUS_OK) {
// The global score should be 0 after a sync. If it's not, items were
// changed during the last sync, and we should schedule an immediate
// follow-up sync.

View File

@ -756,6 +756,37 @@ add_task(async function test_sync_failed_partial_500s() {
await cleanUpAndGo(server);
});
add_task(async function test_sync_failed_partial_noresync() {
enableValidationPrefs();
let server = sync_httpd_setup();
let engine = Service.engineManager.get("catapult");
engine.enabled = true;
engine.exception = "Bad news";
engine._tracker._score = 10;
do_check_eq(Status.sync, SYNC_SUCCEEDED);
do_check_true(await setUp(server));
let resyncDoneObserver = promiseOneObserver("weave:service:resyncs-finished");
await Service.sync();
do_check_eq(Status.service, SYNC_FAILED_PARTIAL);
function onSyncStarted() {
do_throw("Should not start resync when previous sync failed");
}
Svc.Obs.add("weave:service:sync:start", onSyncStarted);
await resyncDoneObserver;
Svc.Obs.remove("weave:service:sync:start", onSyncStarted);
engine._tracker._store = 0;
await cleanUpAndGo(server);
});
add_task(async function test_sync_failed_partial_400s() {
enableValidationPrefs();