This repository was archived by the owner on Dec 6, 2024. It is now read-only.

Description
With the current mapathon ongoing, we've seen the firebase bill go through the roof, even with @Hagellach37 's fix 2-3 days ago on this code (which limits loading to the mappers who've opened the app in the last 24h, instead of all users ever).
There is still a lot of download happening, apparently because users keep refreshing the leaderboard a lot more than we expected.
An option to mitigate this cost in downloads could be to run a function server-side (within firebase) that prepares and caches values to show. For instance, we could imagine running a function every 5 minutes, which would simply run the current query, and copy the result onto some cloud storage (or VPN), and modify the frontend to load that file from bulk storage instead of firebase (and we put some caching logic there so that browsers don't reload more often than once/5 minutes for instance).
This would give us both lower transfer costs (we would effectively only have 1 load/5 minutes), and possibly faster loading for the leaderboard.