Skip to content

Commit

Permalink
fetchActions: Pull await backoffMachine.wait() out of catch block.
Browse files Browse the repository at this point in the history
As Greg points out [1], this makes the most sense conceptually; it's
happening at the bottom of the loop, just before a new iteration
starts. The `return` in the `try` block is enough to ensure that
this wait won't interfere with a successful fetch.

[1]: zulip#4166 (comment)
  • Loading branch information
chrisbobbe committed Jan 11, 2021
1 parent 7c7ebe7 commit 6cfe729
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/message/fetchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ export async function tryFetch<T>(func: () => Promise<T>): Promise<T> {
if (isClientError(e)) {
throw e;
}
await backoffMachine.wait();
}
await backoffMachine.wait();
}
// Without this, Flow 0.92.1 does not know this code is unreachable,
// and it incorrectly thinks Promise<undefined> could be returned,
Expand Down

0 comments on commit 6cfe729

Please sign in to comment.