Skip to content
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

Don't send requests for version.txt from every tab #706

Open
matthew-white opened this issue Jan 21, 2023 · 0 comments
Open

Don't send requests for version.txt from every tab #706

matthew-white opened this issue Jan 21, 2023 · 0 comments
Labels
refactor Improves code without altering behavior

Comments

@matthew-white
Copy link
Member

matthew-white commented Jan 21, 2023

Frontend requests /version.txt every minute in order to check whether the server has been rebuilt. It shows a message if version.txt has changed. This is implemented using the checkVersion() method of the App component.

Requesting /version.txt every minute is already a lot of requests. That number is compounded by the fact that every tab is sending that request every minute. Instead, I think it'd be better if only one tab sent a request each minute. If one tab has sent a request for version.txt in the last minute, then other tabs don't need to.

One sequence to consider
  • Open Frontend in one tab.
  • Upgrade the server.
  • Open Frontend in another tab before the first tab next requests /version.txt.
  • Once the first tab has received version.txt, it should show an alert and inform the second tab about the latest content of version.txt. But the second tab shouldn't show an alert because it is already on that version. In this sequence today, the second tab wouldn't show an alert.

One way we could implement this is using local storage, similar to how we implement simultaneous logout across tabs. I also noticed that BroadcastChannel is at last supported in Safari, so that's something we may be able to use as well.

@matthew-white matthew-white added the enhancement New feature or behavior label Jan 21, 2023
@matthew-white matthew-white added refactor Improves code without altering behavior and removed enhancement New feature or behavior labels Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Improves code without altering behavior
Projects
None yet
Development

No branches or pull requests

1 participant