openclimatefix / quartz-frontend

Front End repo for the Nowcasting project.
https://openclimatefix.org/projects/nowcasting/
MIT License
100 stars 16 forks source link

Prevent UI from making requests too often #394

Closed braddf closed 1 year ago

braddf commented 1 year ago

Describe the bug

It's possible (probably, in fact) that the UI is making more requests to the API than needed, and only taking notice of the latest request to return. This would cause unnecessary strain on the API, and if the cache isn't quite working properly, also the DB, which is more of an issue. This may or may not be the reason for the EC2 instance locking up and falling over periodically when multiple users are loading/actively using the UI simultaneously.

To Reproduce

Steps to reproduce the behavior:

  1. Open the Quartz UI
  2. Open browser DevTools > Network tab
  3. Watch the requests being made by the UI as you click on charts/change view etc.
  4. See many requests, and possibly then no requests returning successfully if the API falls over.

Expected behavior

Should only be requesting new data periodically, perhaps at the 5 minute auto-update interval that the app runs internally, or at least not more than once every couple of minutes.

Additional context

N/A

peterdudfield commented 1 year ago

this now done?