Skip to content

Fetch leaderboard data files concurrently #68

@Sudarshanhp

Description

@Sudarshanhp

Description

In frontend/leaderboard.html, the fetchLeaderboardData() function currently fetches four independent leaderboard JSON files sequentially:

  • overall.json
  • monthly.json
  • weekly.json
  • daily.json

These files are fetched inside a for...of loop using await, so each request waits for the previous one to finish before starting.

Problem

The four JSON files are independent of each other, so they do not need to be fetched one by one. Sequential fetching can make the leaderboard load slower than necessary.

Proposed Solution

Replace the sequential for...of fetch loop with Promise.allSettled().

This will allow all four requests to start concurrently while still handling individual request failures safely.

Promise.allSettled() is preferred over Promise.all() because if one request fails, the other successful requests can still be used.

Expected Outcome

  • Leaderboard JSON files are fetched concurrently.
  • Loading performance improves.
  • Failure of one leaderboard JSON request does not block the others.
  • Existing leaderboard behavior remains unchanged.

File to Update

frontend/leaderboard.html

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions