File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -760,6 +760,8 @@ class UpdateMachine {
760760
761761 void poll () async {
762762 final backoffMachine = BackoffMachine ();
763+ int accumlatedTransientFailureCount = 0 ;
764+ const transientFailureCountNotifyThreshold = 10 ;
763765
764766 while (true ) {
765767 if (_debugLoopSignal != null ) {
@@ -787,8 +789,11 @@ class UpdateMachine {
787789 case Server5xxException () || NetworkException ():
788790 assert (debugLog ('Transient error polling event queue for $store : $e \n '
789791 'Backing off, then will retry…' ));
790- // TODO tell user if transient polling errors persist
791792 // TODO reset to short backoff eventually
793+ accumlatedTransientFailureCount++ ;
794+ if (accumlatedTransientFailureCount > transientFailureCountNotifyThreshold) {
795+ reportErrorToUserInDialog ('Failed to reach server. Will retry: $e ' );
796+ }
792797 await backoffMachine.wait ();
793798 assert (debugLog ('… Backoff wait complete, retrying poll.' ));
794799 continue ;
@@ -804,6 +809,7 @@ class UpdateMachine {
804809 }
805810
806811 store.isLoading = false ;
812+ accumlatedTransientFailureCount = 0 ;
807813 final events = result.events;
808814 for (final event in events) {
809815 await store.handleEvent (event);
You can’t perform that action at this time.
0 commit comments