AlexLipp / thames-sewage

Realtime mapping of sewage release events in Thames basin
GNU General Public License v3.0
11 stars 0 forks source link

Generate API history more efficiently than querying the entire history at once by having a slow and fast update system #22

Open AlexLipp opened 6 months ago

AlexLipp commented 6 months ago

Currently the history bar-code is generated, using POOPy, by querying the entire history for every monitor going back to the start of time (May 2022). Whilst comprehensive, this system is very intensive and takes a long time. Additionally, as time progresses, more and more data will be stored in the API making it even more intensive to query. Additionally, it increases the chances of a request being bounced which will terminate the entire process increasing downtime (also undesirable).

A better approach would be to only occasionally (e.g., weekly) refresh very old data (which does not update very often) and instead only update the last week (say). This would reduce the number of overall requests made, increase the speed of the more frequent updates, and reduce the chance of downtime from bad requests.