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 440618 514176025ba85a904f33ba9bd761bf12b45b6e56
parent 440617 fcdb3b1d828500d41c76972112ed40aae690394e
child 440619 4bbdea462357e42a8e4580dfc425032376d83e93
push id36274
push usergkruglov@mozilla.com
push dateThu, 17 Nov 2016 22:31:17 +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);