Skip to content

Commit 59609d7

Browse files
committed
store [nfc]: Dedupe report/retry logic for transient polling errors
1 parent 1bf4422 commit 59609d7

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

lib/model/store.dart

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,21 +1042,14 @@ class UpdateMachine {
10421042
assert(debugLog('… Event queue replaced.'));
10431043
return;
10441044

1045-
case Server5xxException():
1046-
assert(debugLog('Transient error polling event queue for $store: $e\n'
1047-
'Backing off, then will retry…'));
1048-
maybeReportToUserTransientError(e);
1049-
await (backoffMachine ??= BackoffMachine()).wait();
1050-
if (_disposed) return;
1051-
assert(debugLog('… Backoff wait complete, retrying poll.'));
1052-
continue;
1053-
10541045
case NetworkException():
1046+
case Server5xxException():
10551047
assert(debugLog('Transient error polling event queue for $store: $e\n'
10561048
'Backing off, then will retry…'));
1057-
if (e.cause is! SocketException) {
1058-
// Heuristic check to only report interesting errors to the user.
1049+
if (e is NetworkException && e.cause is SocketException) {
1050+
// The error is boring; skip reporting it to the user.
10591051
// A [SocketException] is common when the app returns from sleep.
1052+
} else {
10601053
maybeReportToUserTransientError(e);
10611054
}
10621055
await (backoffMachine ??= BackoffMachine()).wait();

0 commit comments

Comments
 (0)