Skip to content

Commit

Permalink
fetch actions: Retry on message fetch failure.
Browse files Browse the repository at this point in the history
Currently, no attempt is made to retry fetching messages if it
fails.

Add `tryUntilSuccessful()` to `fetchMessages()` to retry fetching
messages.

Fixes zulip#3281.
  • Loading branch information
agrawal-d committed Feb 16, 2020
1 parent 24bba64 commit cd191d6
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 @@ -62,13 +62,8 @@ export const fetchMessages = (
) => async (dispatch: Dispatch, getState: GetState) => {
const useFirstUnread = anchor === FIRST_UNREAD_ANCHOR;
dispatch(messageFetchStart(narrow, numBefore, numAfter));
const { messages, found_newest, found_oldest } = await api.getMessages(
getAuth(getState()),
narrow,
anchor,
numBefore,
numAfter,
useFirstUnread,
const { messages, found_newest, found_oldest } = await tryUntilSuccessful(() =>
api.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 cd191d6

Please sign in to comment.