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

Take steps to avoid serving an outdated version of the interop category data #3142

Closed
DanielRyanSmith opened this issue Feb 2, 2023 · 6 comments
Labels
good first issue Good for newcomers GSoC starter bugs interop Issues with the Interop dashboards

Comments

@DanielRyanSmith
Copy link
Contributor

Upon releasing the Interop 2023 dashboard, some users were unable to see the page because the site would sometimes reference an older cached version of webapp/static/interop-data.json that did not have Interop 2023 category data. The file was renamed to ensure the latest version was referenced, but ideally this category data would be pulled from an endpoint rather than referenced in its current form to avoid this situation from happening again.

@DanielRyanSmith DanielRyanSmith added good first issue Good for newcomers interop Issues with the Interop dashboards labels Feb 2, 2023
@DanielRyanSmith DanielRyanSmith changed the title Pull interop data from an endpoint rather than static JSON Pull interop category data from an endpoint rather than static JSON Feb 2, 2023
@foolip
Copy link
Member

foolip commented Feb 2, 2023

Do you know at what layer the caching was and whether the /api URLs are immune to the same problem?

@KyleJu
Copy link
Collaborator

KyleJu commented Feb 2, 2023

Do you know at what layer the caching was and whether the /api URLs are immune to the same problem?

After some digging, it is caused by the GCP default cache for all static files, as shown by

Screenshot 2023-02-02 at 3 39 47 PM

The JSON filed lives under static/interop-data_v2.json. We have a default expiration for 24 hours for this type of cache. Ideally moving it out of the static file folder should solve the problem, or even put them in the wpt-interop Javascript. We also cache all the files served by the component handler. So as long as this file is not served through component handler API, having a separate API endpoint should work.

@jcscottiii
Copy link
Collaborator

Here's a possible improvement for this:
Add a query parameter with the app version to the static assets.

We do this in ChromeStatus. We can do the same thing for the template that renders interop.js. When the backend renders the page, the browser will cache “interop.js?v=VERSION” which will change between version deployments. As a result, it will retrieve the new version of interop.js for VERSION+1.

@racheljay
Copy link
Contributor

I would like to take a look at this issue. To make sure I'm understanding correctly, we want to make sure that fetchYearData() is pulling the most recent data available and not the cached version of interop-data.json. Would it be a viable solution to export the JSON data to a .js file outside of /static and have fetchYearData() fetch data from that? Or would it be better to create an endpoint to populate the data directly?

@DanielRyanSmith
Copy link
Contributor Author

DanielRyanSmith commented Mar 8, 2023

Hello @racheljay! Thanks for the inquiry, and any help is welcome. From my understanding of @KyleJu's explanation of the specific cause of our problem, the most important requirement here is to move this data out of the webapp/static folder and have it live somewhere else, which would fix the GCP caching issue. This can be done in many ways, and the option you laid out should be sufficient. The prospect of pulling this information from an endpoint was just an initial idea of a possible way to avoid serving an outdated cached version of this file. I'll rename this issue accordingly.

@DanielRyanSmith DanielRyanSmith changed the title Pull interop category data from an endpoint rather than static JSON Take steps to avoid serving an outdated version of the interop category data Mar 8, 2023
@DanielRyanSmith
Copy link
Contributor Author

Closing this now, as I believe we've addressed this to avoid it in the future. Thanks for the help @racheljay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers GSoC starter bugs interop Issues with the Interop dashboards
Projects
None yet
Development

No branches or pull requests

5 participants