-
-
Notifications
You must be signed in to change notification settings - Fork 651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Time out initial fetch, and go to account-picker screen #4165
Comments
|
Huh, good catch -- I'd looked for uses of Reading it, I think it'd be fine for it to continue to use the helper when it grows a timeout, or also fine for it to just have its current behavior inlined as a BackoffMachine loop... or really basically fine for it to just try once and not bother retrying, just as I think the reason it differs from |
`tryUntilSuccessful` is about to grow a timeout, which we've had in mind in particular for the initial fetch. It's also about to be moved into this file, and we want to keep its association with `doInitialFetch` by putting it directly above it, with nothing in between. Removing this call site lets us do so without ESLint complaining of `no-use-before-define`. And Greg says it's all the same to him [1], especially since `fetchPrivateMessages` is doomed to be deleted anyway, as the JSDoc says. [1]: zulip#4165 (comment)
As Greg says [1], it's always been closely tied to `doInitialFetch`'s specific needs, with its handling of 4xx errors. We're about to make it more so, by adding timeout logic. [1]: zulip#4165 (comment)
Using `INITIAL_FETCH_ABORT` and `promiseTimeout`, which we set up in the last few commits, abort and go to the accounts screen if the initial fetch is taking too long. Fixes: zulip#4165
Using `INITIAL_FETCH_ABORT` and `promiseTimeout`, which we set up in the last few commits, abort and go to the accounts screen if the initial fetch is taking too long. Fixes: zulip#4165
Using `INITIAL_FETCH_ABORT` and `promiseTimeout`, which we set up in the last few commits, abort and go to the accounts screen if the initial fetch is taking too long. Fixes: zulip#4165
As Greg says [1], it's always been closely tied to `doInitialFetch`'s specific needs, with its handling of 4xx errors. We're about to make it more so, by adding timeout logic. Also, remove two pretty trivial tests, and adapt the third (that tests that a retry is done) to use Lolex. Add another test to confirm that a 4xx error does indeed halt the retry loop and get thrown. [1]: zulip#4165 (comment)
Using `INITIAL_FETCH_ABORT` and `promiseTimeout`, which we set up in the last few commits, abort and go to the accounts screen if the initial fetch is taking too long. Fixes: zulip#4165
Using `INITIAL_FETCH_ABORT` and `promiseTimeout`, which we set up in the last few commits, abort and go to the accounts screen if the initial fetch is taking too long. Fixes: zulip#4165
`tryUntilSuccessful` is about to grow a timeout, which we've had in mind in particular for the initial fetch. It's also about to be moved into this file, and we want to keep its association with `doInitialFetch` by putting it directly above it, with nothing in between. Removing this call site lets us do so without ESLint complaining of `no-use-before-define`. And Greg says it's all the same to him [1], especially since `fetchPrivateMessages` is doomed to be deleted anyway, as the JSDoc says. [1]: zulip#4165 (comment)
As Greg says [1], it's always been closely tied to `doInitialFetch`'s specific needs, with its handling of 4xx errors. We're about to make it more so, by adding timeout logic. [1]: zulip#4165 (comment)
Using `INITIAL_FETCH_ABORT` and `promiseTimeout`, which we set up in the last few commits, abort and go to the accounts screen if the initial fetch is taking too long. Fixes: zulip#4165
`tryUntilSuccessful` is about to grow a timeout, which we've had in mind in particular for the initial fetch. It's also about to be moved into this file, and we want to keep its association with `doInitialFetch` by putting it directly above it, with nothing in between. Removing this call site lets us do so without ESLint complaining of `no-use-before-define`. And Greg says it's all the same to him [1], especially since `fetchPrivateMessages` is doomed to be deleted anyway, as the JSDoc says. [1]: zulip#4165 (comment)
As Greg says [1], it's always been closely tied to `doInitialFetch`'s specific needs, with its handling of 4xx errors. We're about to make it more so, by adding timeout logic. [1]: zulip#4165 (comment)
Using `INITIAL_FETCH_ABORT` and `promiseTimeout`, which we set up in the last few commits, abort and go to the accounts screen if the initial fetch is taking too long. Fixes: zulip#4165
`tryUntilSuccessful` is about to grow a timeout, which we've had in mind in particular for the initial fetch. It's also about to be moved into this file, and we want to keep its association with `doInitialFetch` by putting it directly above it, with nothing in between. Removing this call site lets us do so without ESLint complaining of `no-use-before-define`. And Greg says it's all the same to him [1], especially since `fetchPrivateMessages` is doomed to be deleted anyway, as the JSDoc says. [1]: zulip#4165 (comment)
As Greg says [1], it's always been closely tied to `doInitialFetch`'s specific needs, with its handling of 4xx errors. We're about to make it more so, by adding timeout logic. [1]: zulip#4165 (comment)
`tryUntilSuccessful` is about to grow a timeout, which we've had in mind in particular for the initial fetch. It's also about to be moved into this file, and we want to keep its association with `doInitialFetch` by putting it directly above it, with nothing in between. Removing this call site lets us do so without ESLint complaining of `no-use-before-define`. And Greg says it's all the same to him [1], especially since `fetchPrivateMessages` is doomed to be deleted anyway, as the JSDoc says. [1]: zulip#4165 (comment)
As Greg says [1], it's always been closely tied to `doInitialFetch`'s specific needs, with its handling of 4xx errors. We're about to make it more so, by adding timeout logic. [1]: zulip#4165 (comment)
Using `INITIAL_FETCH_ABORT` and `promiseTimeout`, which we set up in the last few commits, abort and go to the accounts screen if the initial fetch is taking too long. Fixes: zulip#4165
Using `INITIAL_FETCH_ABORT` and `promiseTimeout`, which we set up in the last few commits, abort and go to the accounts screen if the initial fetch is taking too long. Fixes: zulip#4165
This was accidentally closed by merging #4226. A clause like |
Yikes, indeed!! Thanks for catching this. |
EDIT: We've figured out that snag and the PR is ready for review 😄 |
Using `INITIAL_FETCH_ABORT` and `promiseTimeout`, which we set up in the last few commits, abort and go to the accounts screen if the initial fetch is taking too long. Fixes: zulip#4165
Using `INITIAL_FETCH_ABORT` and `promiseTimeout`, which we set up in the last few commits, abort and go to the accounts screen if the initial fetch is taking too long. Fixes: zulip#4165
Using `INITIAL_FETCH_ABORT` and `promiseTimeout`, which we set up in the last few commits, abort and go to the accounts screen if the initial fetch is taking too long. Fixes: zulip#4165
Using `INITIAL_FETCH_ABORT` and `promiseTimeout`, which we set up in the last few commits, abort and go to the accounts screen if the initial fetch is taking too long. Fixes: zulip#4165
Using `INITIAL_FETCH_ABORT` and `promiseTimeout`, which we set up in the last few commits, abort and go to the accounts screen if the initial fetch is taking too long. Fixes: zulip#4165
We already declare a direct dependency on Jest 26 (and have done since fb23341), but it doesn't get pulled in. Empirically, that seems to be because `jest-expo` brings in Jest 25. We know we'll soon want Jest 26 for a few things: - The "modern" implementation of fake timers [1], for zulip#4165. - The `selectProjects` CLI argument [2], for testing Android codepaths in a nice way (later in this series). But we've *also* realized that it'd be nice to keep `jest-expo`, to use the `jest-expo/ios` and `jest-expo/android` presets (which we'll do later in this series). We hope we can end the pattern of adding and removing `jest-expo` again and again: 62621ef jest: Add `jest-expo` preset, to be used in the next commit. 347aa96 jest: Back out `jest-expo` preset, for now. c4fca9d jest: Add and use `jest-expo` preset, again. This is a hack because the `resolutions.jest-expo/jest` range `^26.4.1` is incompatible with the original range that `jest-expo` declares; that's `^25.2.0`. We believe this should get us a warning from Yarn; according to a doc [3], "You will receive a warning if your resolution version or range is not compatible with the original version range." I haven't seen a warning like that, even after removing node_modules and running `yarn`; this seems like a Yarn bug. I've opened expo/expo#12735 to bump Jest in the `jest-expo` project; this hack should hopefully be fine while we wait for that. [1] https://github.com/facebook/jest/blob/master/CHANGELOG.md#2600 [2] https://github.com/facebook/jest/blob/master/CHANGELOG.md#2610 [3] https://classic.yarnpkg.com/en/docs/selective-version-resolutions/#toc-tips-tricks
We've had Jest 26 as a direct dependency for a while (since fb23341), so it's surprising that the `jest` command hasn't been using it. As Greg points out [0], that turns out to be because `jest-expo` apparently provides its own wrapper for the `jest` command, using the Jest that `jest-expo` depends on. That's Jest 25, even in `jest-expo`'s latest. And Yarn ends up giving us that wrapper. We know we'll soon want to use Jest 26 for a few things: - The "modern" implementation of fake timers [1], for zulip#4165. - The `selectProjects` CLI argument [2], for testing Android codepaths in a nice way (later in this series). But we've *also* realized that we don't really want to jettison `jest-expo` again, as we've done a few times as we learn new things: 62621ef jest: Add `jest-expo` preset, to be used in the next commit. 347aa96 jest: Back out `jest-expo` preset, for now. c4fca9d jest: Add and use `jest-expo` preset, again. In particular, we really want to use the `jest-expo/ios` and `jest-expo/android` presets (which we'll do later in this series). This is a hack because the `resolutions.jest-expo/jest` range `^26.4.1` is incompatible with the original range that `jest-expo` declares; that's `^25.2.0`. We believe this should get us a warning from Yarn; according to a doc [3], "You will receive a warning if your resolution version or range is not compatible with the original version range." I haven't seen a warning like that, even after removing node_modules and running `yarn`; this seems like a Yarn bug. I've opened expo/expo#12735 to bump Jest in the `jest-expo` project; this hack should hopefully be fine while we wait for that. [0] zulip#4700 (comment) [1] https://github.com/facebook/jest/blob/master/CHANGELOG.md#2600 [2] https://github.com/facebook/jest/blob/master/CHANGELOG.md#2610 [3] https://classic.yarnpkg.com/en/docs/selective-version-resolutions/#toc-tips-tricks
We've had Jest 26 as a direct dependency for a while (since fb23341), so it's surprising that the `jest` command hasn't been using it. As Greg points out [0], that turns out to be because `jest-expo` apparently provides its own wrapper for the `jest` command, using the Jest that `jest-expo` depends on. That's Jest 25, even in `jest-expo`'s latest. And Yarn ends up giving us that wrapper. We know we'll soon want to use Jest 26 for a few things: - The "modern" implementation of fake timers [1], for zulip#4165. - The `selectProjects` CLI argument [2], for testing Android codepaths in a nice way (later in this series). But we've *also* realized that we don't really want to jettison `jest-expo` again, as we've done a few times as we learn new things: 62621ef jest: Add `jest-expo` preset, to be used in the next commit. 347aa96 jest: Back out `jest-expo` preset, for now. c4fca9d jest: Add and use `jest-expo` preset, again. In particular, we really want to use the `jest-expo/ios` and `jest-expo/android` presets (which we'll do later in this series). This is a hack because the `resolutions.jest-expo/jest` range `^26.4.1` is incompatible with the original range that `jest-expo` declares; that's `^25.2.0`. We believe this should get us a warning from Yarn; according to a doc [3], "You will receive a warning if your resolution version or range is not compatible with the original version range." I haven't seen a warning like that, even after removing node_modules and running `yarn`; this seems like a Yarn bug. I've opened expo/expo#12735 to bump Jest in the `jest-expo` project; this hack should hopefully be fine while we wait for that. [0] zulip#4700 (comment) [1] https://github.com/facebook/jest/blob/master/CHANGELOG.md#2600 [2] https://github.com/facebook/jest/blob/master/CHANGELOG.md#2610 [3] https://classic.yarnpkg.com/en/docs/selective-version-resolutions/#toc-tips-tricks
We've had Jest 26 as a direct dependency for a while (since fb23341), so it's surprising that the `jest` command hasn't been using it. As Greg points out [0], that turns out to be because `jest-expo` apparently provides its own wrapper for the `jest` command, using the Jest that `jest-expo` depends on. That's Jest 25, even in `jest-expo`'s latest. And Yarn ends up giving us that wrapper. We know we'll soon want to use Jest 26 for a few things: - The "modern" implementation of fake timers [1], for zulip#4165. - The `selectProjects` CLI argument [2], for testing Android codepaths in a nice way (later in this series). But we've *also* realized that we don't really want to jettison `jest-expo` again, as we've done a few times as we learn new things: 62621ef jest: Add `jest-expo` preset, to be used in the next commit. 347aa96 jest: Back out `jest-expo` preset, for now. c4fca9d jest: Add and use `jest-expo` preset, again. In particular, we really want to use the `jest-expo/ios` and `jest-expo/android` presets (which we'll do later in this series). This is a hack because the `resolutions.jest-expo/jest` range `^26.4.1` is incompatible with the original range that `jest-expo` declares; that's `^25.2.0`. We believe this should get us a warning from Yarn; according to a doc [3], "You will receive a warning if your resolution version or range is not compatible with the original version range." I haven't seen a warning like that, even after removing node_modules and running `yarn`; this seems like a Yarn bug. I've opened expo/expo#12735 to bump Jest in the `jest-expo` project; this hack should hopefully be fine while we wait for that. [0] zulip#4700 (comment) [1] https://github.com/facebook/jest/blob/master/CHANGELOG.md#2600 [2] https://github.com/facebook/jest/blob/master/CHANGELOG.md#2610 [3] https://classic.yarnpkg.com/en/docs/selective-version-resolutions/#toc-tips-tricks
We've had Jest 26 as a direct dependency for a while (since fb23341), so it's surprising that the `jest` command hasn't been using it. As Greg points out [0], that turns out to be because `jest-expo` apparently provides its own wrapper for the `jest` command, using the Jest that `jest-expo` depends on. That's Jest 25, even in `jest-expo`'s latest. And Yarn ends up giving us that wrapper. We know we'll soon want to use Jest 26 for a few things: - The "modern" implementation of fake timers [1], for zulip#4165. - The `selectProjects` CLI argument [2], for testing Android codepaths in a nice way (later in this series). But we've *also* realized that we don't really want to jettison `jest-expo` again, as we've done a few times as we learn new things: 62621ef jest: Add `jest-expo` preset, to be used in the next commit. 347aa96 jest: Back out `jest-expo` preset, for now. c4fca9d jest: Add and use `jest-expo` preset, again. In particular, we really want to use the `jest-expo/ios` and `jest-expo/android` presets (which we'll do later in this series). This is a hack because the `resolutions.jest-expo/jest` range `^26.4.1` is incompatible with the original range that `jest-expo` declares; that's `^25.2.0`. We believe this should get us a warning from Yarn; according to a doc [3], "You will receive a warning if your resolution version or range is not compatible with the original version range." I haven't seen a warning like that, even after removing node_modules and running `yarn`; this seems like a Yarn bug. I've opened expo/expo#12735 to bump Jest in the `jest-expo` project; this hack should hopefully be fine while we wait for that. [0] zulip#4700 (comment) [1] https://github.com/facebook/jest/blob/master/CHANGELOG.md#2600 [2] https://github.com/facebook/jest/blob/master/CHANGELOG.md#2610 [3] https://classic.yarnpkg.com/en/docs/selective-version-resolutions/#toc-tips-tricks
We've had Jest 26 as a direct dependency for a while (since fb23341), so it's surprising that the `jest` command hasn't been using it. As Greg points out [0], that turns out to be because `jest-expo` apparently provides its own wrapper for the `jest` command, using the Jest that `jest-expo` depends on. That's Jest 25, even in `jest-expo`'s latest. And Yarn ends up giving us that wrapper. We know we'll soon want to use Jest 26 for a few things: - The "modern" implementation of fake timers [1], for zulip#4165. - The `selectProjects` CLI argument [2], for testing Android codepaths in a nice way (later in this series). But we've *also* realized that we don't really want to jettison `jest-expo` again, as we've done a few times as we learn new things: 62621ef jest: Add `jest-expo` preset, to be used in the next commit. 347aa96 jest: Back out `jest-expo` preset, for now. c4fca9d jest: Add and use `jest-expo` preset, again. In particular, we really want to use the `jest-expo/ios` and `jest-expo/android` presets (which we'll do later in this series). This is a hack because the `resolutions.jest-expo/jest` range `^26.4.1` is incompatible with the original range that `jest-expo` declares; that's `^25.2.0`. We believe this should get us a warning from Yarn; according to a doc [3], "You will receive a warning if your resolution version or range is not compatible with the original version range." I haven't seen a warning like that, even after removing node_modules and running `yarn`; this seems like a Yarn bug. I've opened expo/expo#12735 to bump Jest in the `jest-expo` project; this hack should hopefully be fine while we wait for that. [0] zulip#4700 (comment) [1] https://github.com/facebook/jest/blob/master/CHANGELOG.md#2600 [2] https://github.com/facebook/jest/blob/master/CHANGELOG.md#2610 [3] https://classic.yarnpkg.com/en/docs/selective-version-resolutions/#toc-tips-tricks
So far, `tryFetch`'s only callers are in the initial fetch; so, add handling for the `TimeoutError` there. The choice of value for `requestLongTimeoutMs` comes from a suggestion in zulip#4165's description: > As a minimal version, if the initial fetch takes a completely > unreasonable amount of time (maybe one minute), we should give up > and take you to the account-picker screen so you can try a > different account and server. Fixes: zulip#4165
So far, `tryFetch`'s only callers are in the initial fetch; so, add handling for the `TimeoutError` there. The choice of value for `requestLongTimeoutMs` comes from a suggestion in zulip#4165's description: > As a minimal version, if the initial fetch takes a completely > unreasonable amount of time (maybe one minute), we should give up > and take you to the account-picker screen so you can try a > different account and server. Fixes: zulip#4165
So far, `tryFetch`'s only callers are in the initial fetch; so, add handling for the `TimeoutError` there. The choice of value for `requestLongTimeoutMs` comes from a suggestion in zulip#4165's description: > As a minimal version, if the initial fetch takes a completely > unreasonable amount of time (maybe one minute), we should give up > and take you to the account-picker screen so you can try a > different account and server. Fixes: zulip#4165
So far, `tryFetch`'s only callers are in the initial fetch; so, add handling for the `TimeoutError` there. The choice of value for `requestLongTimeoutMs` comes from a suggestion in zulip#4165's description: > As a minimal version, if the initial fetch takes a completely > unreasonable amount of time (maybe one minute), we should give up > and take you to the account-picker screen so you can try a > different account and server. Fixes: zulip#4165
So far, `tryFetch`'s only callers are in the initial fetch; so, add handling for the `TimeoutError` there. The choice of value for `requestLongTimeoutMs` comes from a suggestion in zulip#4165's description: > As a minimal version, if the initial fetch takes a completely > unreasonable amount of time (maybe one minute), we should give up > and take you to the account-picker screen so you can try a > different account and server. Fixes: zulip#4165
So far, `tryFetch`'s only callers are in the initial fetch; so, add handling for the `TimeoutError` there. The choice of value for `requestLongTimeoutMs` comes from a suggestion in zulip#4165's description: > As a minimal version, if the initial fetch takes a completely > unreasonable amount of time (maybe one minute), we should give up > and take you to the account-picker screen so you can try a > different account and server. Fixes: zulip#4165
If you launch the app, and the last server you'd been using is one that is now impossible to reach... currently we just stay at the loading screen forever, endlessly retrying the initial fetch.
If that's the only server you ever wanted to use, then this isn't so bad, given that there's not much useful we can do until the server is back. But if you'd like to go use some other server, then you're completely blocked from doing so. If the server doesn't come back, your only remedy is to clear the app's data entirely (or uninstall and reinstall) and log into those other servers from scratch. This is #4159, as described at #4159 (comment) .
We should do better. As a minimal version, if the initial fetch takes a completely unreasonable amount of time (maybe one minute), we should give up and take you to the account-picker screen so you can try a different account and server.
(An improved followup version might continue loading but show a message like "Still working..." and an action "Switch account" on the loading screen, after a much shorter period like 7 seconds.)
Here's how I'd go about implementing this:
doInitialFetch
, aroundapi.registerForEvents
with the pair oftryUntilSuccessful
calls.isClientError
case insidetryUntilSuccessful
, and thecatch
block outside it that callsdispatch(logout())
.ProfileCard.js
:dispatch(navigateToAccountPicker())
. Then return out ofdoInitialFetch
.tryUntilSuccessful
into the same file asdoInitialFetch
and just above it, and give it a more specific name liketryFetch
. (This move can be its own commit.) It's always been closely tied to that function's specific needs with its handling of 4xx errors, and we're about to make it more so.dispatch(logout())
ifisClientError(e)
; but otherwise, abort without logging out.The text was updated successfully, but these errors were encountered: