@@ -1008,28 +1008,10 @@ class UpdateMachine {
1008
1008
}
1009
1009
static BackoffMachine ? __unexpectedErrorBackoffMachine;
1010
1010
1011
- /// This controls when we start to report transient errors to the user when
1012
- /// polling.
1013
- ///
1014
- /// At the 6th failure, the expected time elapsed since the first failure
1015
- /// will be 1.55 seocnds.
1016
- static const transientFailureCountNotifyThreshold = 5 ;
1017
-
1018
1011
void poll () async {
1019
1012
assert (! _disposed);
1020
1013
try {
1021
1014
BackoffMachine ? backoffMachine;
1022
- int accumulatedTransientFailureCount = 0 ;
1023
-
1024
- /// This only reports transient errors after reaching
1025
- /// a pre-defined threshold of retries.
1026
- void maybeReportToUserTransientError (Object error) {
1027
- accumulatedTransientFailureCount++ ;
1028
- if (accumulatedTransientFailureCount > transientFailureCountNotifyThreshold) {
1029
- _reportToUserErrorConnectingToServer (error);
1030
- }
1031
- }
1032
-
1033
1015
while (true ) {
1034
1016
if (_debugLoopSignal != null ) {
1035
1017
await _debugLoopSignal! .future;
@@ -1086,7 +1068,7 @@ class UpdateMachine {
1086
1068
assert (debugLog ('Transient error polling event queue for $store : $e \n '
1087
1069
'Backing off, then will retry…' ));
1088
1070
if (shouldReportToUser) {
1089
- maybeReportToUserTransientError (e);
1071
+ _maybeReportToUserTransientError (e);
1090
1072
}
1091
1073
await (backoffMachine ?? = BackoffMachine ()).wait ();
1092
1074
if (_disposed) return ;
@@ -1114,7 +1096,7 @@ class UpdateMachine {
1114
1096
store.isLoading = false ;
1115
1097
// Dismiss existing errors, if any.
1116
1098
reportErrorToUserBriefly (null );
1117
- accumulatedTransientFailureCount = 0 ;
1099
+ _accumulatedTransientFailureCount = 0 ;
1118
1100
1119
1101
final events = result.events;
1120
1102
for (final event in events) {
@@ -1191,6 +1173,24 @@ class UpdateMachine {
1191
1173
}
1192
1174
}
1193
1175
1176
+ /// This controls when we start to report transient errors to the user when
1177
+ /// polling.
1178
+ ///
1179
+ /// At the 6th failure, the expected time elapsed since the first failure
1180
+ /// will be 1.55 seocnds.
1181
+ static const transientFailureCountNotifyThreshold = 5 ;
1182
+
1183
+ int _accumulatedTransientFailureCount = 0 ;
1184
+
1185
+ /// This only reports transient errors after reaching
1186
+ /// a pre-defined threshold of retries.
1187
+ void _maybeReportToUserTransientError (Object error) {
1188
+ _accumulatedTransientFailureCount++ ;
1189
+ if (_accumulatedTransientFailureCount > transientFailureCountNotifyThreshold) {
1190
+ _reportToUserErrorConnectingToServer (error);
1191
+ }
1192
+ }
1193
+
1194
1194
void _reportToUserErrorConnectingToServer (Object error) {
1195
1195
final localizations = GlobalLocalizations .zulipLocalizations;
1196
1196
reportErrorToUserBriefly (
0 commit comments