Bug 1291821 - Ensure sink repository is aware of new events coming from the source r=rnewman draft
authorGrisha Kruglov <gkruglov@mozilla.com>
Tue, 11 Oct 2016 20:00:09 -0700
changeset 445747 4d2cb5b99c63354176f8da4e1a392f0e1d0fe822
parent 445746 a92e9a723ac2b859de488c35eba1bace0d77a7d6
child 445748 b9d2c8a69fe194ee856621bc8db203d53d55eb72
push id37599
push usergkruglov@mozilla.com
push dateWed, 30 Nov 2016 06:33:43 +0000
reviewersrnewman
bugs1291821
milestone53.0a1
Bug 1291821 - Ensure sink repository is aware of new events coming from the source r=rnewman MozReview-Commit-ID: DgqGzfoJxhj
mobile/android/services/src/main/java/org/mozilla/gecko/sync/synchronizer/RecordsChannel.java
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/synchronizer/RecordsChannel.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/synchronizer/RecordsChannel.java
@@ -200,16 +200,17 @@ public class RecordsChannel implements
       Logger.error(LOG_TAG, "Got NoStoreDelegateException in RecordsChannel.store(). This should not occur. Aborting.", e);
       delegate.onFlowStoreFailed(this, e, record.guid);
     }
   }
 
   @Override
   public void onFetchFailed(Exception ex) {
     Logger.warn(LOG_TAG, "onFetchFailed. Informing sink, calling for immediate stop.", ex);
+    sink.sourceFailed(ex);
     numFetchFailed.incrementAndGet();
     this.consumer.halt();
     delegate.onFlowFetchFailed(this, ex);
   }
 
   @Override
   public void onFetchedRecord(Record record) {
     numFetched.incrementAndGet();
@@ -222,16 +223,17 @@ public class RecordsChannel implements
     Logger.trace(LOG_TAG, "onFetchCompleted. Stopping consumer once stores are done.");
     Logger.trace(LOG_TAG, "Fetch timestamp is " + fetchEnd);
     this.fetchEnd = fetchEnd;
     this.consumer.queueFilled();
   }
 
   @Override
   public void onBatchCompleted() {
+    this.sink.storeFlush();
   }
 
   @Override
   public void onRecordStoreFailed(Exception ex, String recordGuid) {
     Logger.trace(LOG_TAG, "Failed to store record with guid " + recordGuid);
     numStoreFailed.incrementAndGet();
     this.consumer.stored();
     delegate.onFlowStoreFailed(this, ex, recordGuid);