-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
Attempt to prevent reload loops #22529
Conversation
A `reload.initiate({immediate: true, ...})` *should* not return, as it should trigger a `window.location.reload` and stop execution. In the event that it continues execution and returns (for instance, due to being in the background and reloads being suppressed for power-saving -- see zulip#6821), there is no need to fall through and potentially schedule a 90-second-later retry.
Prevent a non-immediate reload from being scheduled while an immediate reload is already in progress. This is highly unlikely in practice, but is a reasonable safeguard.
We have observed infrequent storms of accesses (tens of thousands of requests to minute) to `/` after an event queue expires. The current best theory is that the act of reloading the page itself triggers a focus event, which itself triggers a reload before the prior one had had time to do anything but send the network request. Since the `focus` event here is merely as a backstop in case the synchronous reloading and deferred reloading fail, we need only run it once.
Merged, thanks @alexmv! |
We may want to backport this if it seems to work. I'm going to tag it as such for now, and we can decide later if we want to skip it. |
I'm skipping backporting this until #22721 is resolved, just in case the changes in this PR are related to that report. |
#22721 (comment) seems to confirm that this is not a recent regression; is there any other reason to not backport this? |
No, we can do so now. |
Opened #23199 for the backport. |
Self-review checklist
(variable names, code reuse, readability, etc.).
Communicate decisions, questions, and potential concerns.
Individual commits are ready for review (see commit discipline).
Completed manual review and testing of the following: