Skip to content

[Performance] Client-side polling fetches all large JSON datasets redundantly every 2 minutes #285

Description

@yashvi-3106

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

  1. Load leaderboard.html in the browser and open the Network Tab in DevTools.
  2. Observe the browser requesting all 4 leaderboard datasets and last-sync.json simultaneously.
  3. 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():

  1. Poll only the lightweight last-sync.json metadata file every 2 minutes.
  2. Compare the fetched lastSync timestamp against the current loaded _lastKnownSyncTime.
  3. Only trigger the requests for overall.json, monthly.json, weekly.json, and daily.json if a new sync has actually occurred.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions