Description:
Problem Description
In leaderboard.html, the client polls for updates every 2 minutes by requesting all four main data files (overall.json, monthly.json, weekly.json, daily.json) as well as last-sync.json in parallel.
For a large number of users, this results in huge, redundant bandwidth usage and unnecessary network traffic, especially since the datasets only change after a sync operation completes.
Steps to Reproduce
- Load
leaderboard.html in the browser and open the Network Tab in DevTools.
- Observe the browser requesting all 4 leaderboard datasets and
last-sync.json simultaneously.
- Every 2 minutes, all files are downloaded again regardless of whether the sync timestamp changed.
Expected Behavior
The frontend should check if new data is available before downloading several potentially large dataset JSON files.
Proposed Solution
Optimize the polling logic in fetchLeaderboardData():
- Poll only the lightweight
last-sync.json metadata file every 2 minutes.
- Compare the fetched
lastSync timestamp against the current loaded _lastKnownSyncTime.
- Only trigger the requests for
overall.json, monthly.json, weekly.json, and daily.json if a new sync has actually occurred.
Description:
Problem Description
In
leaderboard.html, the client polls for updates every 2 minutes by requesting all four main data files (overall.json,monthly.json,weekly.json,daily.json) as well aslast-sync.jsonin parallel.For a large number of users, this results in huge, redundant bandwidth usage and unnecessary network traffic, especially since the datasets only change after a sync operation completes.
Steps to Reproduce
leaderboard.htmlin the browser and open the Network Tab in DevTools.last-sync.jsonsimultaneously.Expected Behavior
The frontend should check if new data is available before downloading several potentially large dataset JSON files.
Proposed Solution
Optimize the polling logic in
fetchLeaderboardData():last-sync.jsonmetadata file every 2 minutes.lastSynctimestamp against the current loaded_lastKnownSyncTime.overall.json,monthly.json,weekly.json, anddaily.jsonif a new sync has actually occurred.