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

Cache initial load endpoint data and use statuses endpoint to check for new data #451

Open
RyanTG opened this issue Jul 8, 2022 · 2 comments

Comments

@RyanTG
Copy link
Collaborator

RyanTG commented Jul 8, 2022

See latest comment #451 (comment)

Original comment:

We can use this issue to discuss strategies to speed up initial load - though not only initial load, but also all map loads.

Caching:

  • Caching the full list of machines
  • Caching the full list of operators
  • Caching anything else?

Location Data:

  • Can anything be removed from what we currently pass down? I assume the list of machines per location is the biggest drag, but as far as I can tell we have to include this full list with every location so that the Filter will work.
@RyanTG RyanTG added the 5.2.13 label Oct 28, 2022
@RyanTG RyanTG added 5.2.15 and removed 5.2.14 labels Dec 6, 2022
@RyanTG RyanTG added 5.2.16 and removed 5.2.15 labels Jan 4, 2023
@RyanTG RyanTG added 5.2.19 and removed 5.2.17 labels Jan 17, 2023
@RyanTG RyanTG added 5.2.20 and removed 5.2.19 labels Mar 9, 2023
@RyanTG
Copy link
Collaborator Author

RyanTG commented Mar 29, 2023

Some notes:

regions.json endpoint

This is used for the motd and for the search, from what I can tell. This endpoint includes admin email addresses (seems like we don't need this on the endpoint at all).

I propose reviewing whether it is safe to completely remove the admin email addresses. That will slightly reduce the size of the endpoint. EDIT: looks like I did that at one point but then reverted it pinballmap/pbm#1234

/regions/location_and_machine_counts.json

This endpoint is used by About and by SignupLogin. It doesn't seem to be an intense endpoint, but it's also unnecessary to pull it every time someone opens the app. It's only needed for those two screens.

I propose I don't know. I think I would propose not pulling this on initial load, and only pulling it when those screens are visited.

/location_types.json

This seems to be used right away by for the location type icons in "List"

I propose nuttin.

/machines.json /operators.json

From what I can tell, these endpoints contain IDs that are used by the /locations endpoint, and are necessary to have on initial load.

I propose nothing, unless it's not a terrible idea to include machine_name and operator_name in the locations/:id.json endpoint (like we do with last_updated_by_username, and like how we do on the locations/closest_by_lat_lon.json endpoint). Doing so could save us from pulling down these endpoints until needed on the Find* screens.

@RyanTG
Copy link
Collaborator Author

RyanTG commented May 5, 2023

Ok, latest idea is to use this new endpoint that stores that updated_at value for those four tables, indicating when/if they were recently updated https://pinballmap.com/api/v1/statuses.json

We store the updated_at values for each of those status_types in redux, and parse the endpoint to compare with what we have stored. Then if the values are different, we query that full endpoint.

@RyanTG RyanTG added 5.2.28 and removed 5.2.20 labels May 5, 2023
@RyanTG RyanTG removed the 5.2.28 label Jun 1, 2023
@RyanTG RyanTG changed the title Speed up initial load Cache initial load endpoint data and use statuses endpoint to check for new data Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant