File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -807,8 +807,24 @@ class UpdateMachine {
807
807
}
808
808
}
809
809
810
+ // After one successful request, we reset backoff to its initial state.
811
+ // That way if the user is off the network and comes back on, the app
812
+ // doesn't wind up in a state where it's slow to recover the next time
813
+ // one request fails.
814
+ //
815
+ // This does mean that if the server is having trouble and handling some
816
+ // but not all of its requests, we'll end up doing a lot more retries than
817
+ // if we stayed at the max backoff interval; partway toward what would
818
+ // happen if we weren't backing off at all.
819
+ //
820
+ // But at least for [getEvents] requests, as here, it should be OK,
821
+ // because this is a long-poll. That means a typical successful request
822
+ // takes a long time to come back; in fact longer than our max backoff
823
+ // duration (which is 10 seconds). So if we're getting a mix of successes
824
+ // and failures, the successes themselves should space out the requests.
810
825
backoffMachine = null ;
811
826
store.isLoading = false ;
827
+
812
828
final events = result.events;
813
829
for (final event in events) {
814
830
await store.handleEvent (event);
You can’t perform that action at this time.
0 commit comments