Skip to content

fix: add fetch timeouts to CodeChef, Codeforces, and GitHub services to prevent stalled requests #100

@rishab11250

Description

@rishab11250

Description

LeetCode service uses an 8-second AbortController timeout, but CodeChef, Codeforces, GitHub REST, and GitHub GraphQL services use bare fetch() with no timeout. If any of these external APIs hang or respond slowly, the entire profile render stalls until Vercel's 10-second serverless function timeout kills it, returning a broken image to the user.

Affected Services

  • src/services/codechef.service.js — no timeout
  • src/services/codeforces.service.js — no timeout
  • src/services/github.service.js (fetchUserProfile, fetchUserRepos, fetchAvatarDataUri) — no timeout
  • src/services/github-graphql.service.js (fetchContributionData) — no timeout

Steps to Reproduce

  1. Remove network access (or simulate a slow API)
  2. Request a profile with codeforces=true
  3. The request hangs for 10s, then returns a broken SVG/error

Suggested Fix

Add AbortController with an 8-second timeout to each fetch() call, matching the existing pattern in leetcode.service.js lines 32-33.

Files to Modify

  • src/services/codechef.service.js
  • src/services/codeforces.service.js
  • src/services/github.service.js
  • src/services/github-graphql.service.js

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions