Skip to content

Commit

Permalink
fetch: Retry fetching messages, indefinitely.
Browse files Browse the repository at this point in the history
Fixes #3281.

This simple change greatly improves the experience with spotty
network connections.

I have a small concern about the request's retry not being cancelled.
I find the compromise to be worth it.  I am working on a more generic
rework of `tryUntilScuccessful` which will allow it to be cancelled
and will include all of this function's invocations.
  • Loading branch information
borisyankov authored and gnprice committed May 25, 2019
1 parent 36ae1b9 commit 7ed7e52
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/message/fetchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,8 @@ export const fetchMessages = (
useFirstUnread: boolean = false,
) => async (dispatch: Dispatch, getState: GetState) => {
dispatch(messageFetchStart(narrow, numBefore, numAfter));
const { messages, found_newest, found_oldest } = await getMessages(
getAuth(getState()),
narrow,
anchor,
numBefore,
numAfter,
useFirstUnread,
const { messages, found_newest, found_oldest } = await tryUntilSuccessful(() =>
getMessages(getAuth(getState()), narrow, anchor, numBefore, numAfter, useFirstUnread),
);
dispatch(
messageFetchComplete(messages, narrow, anchor, numBefore, numAfter, found_newest, found_oldest),
Expand Down

0 comments on commit 7ed7e52

Please sign in to comment.