Skip to content

[Enhancement] Add Retry Mechanism for Failed API Requests #1440

@Nandini868686

Description

@Nandini868686

Problem

DailyForge's backend is deployed on Render's free tier, where services may go to sleep after periods of inactivity. When users access the application after a period of inactivity, initial API requests can fail or timeout while the backend spins up.

This can result in a poor user experience, especially for first-time visitors who may think the application is broken.

Proposed Solution

Implement automatic retry logic for transient API failures.

Suggested Behavior

  • Retry requests for network errors and temporary server failures (5xx responses).
  • Use exponential backoff between retry attempts.
  • Display a loading or "Reconnecting..." message while retries are in progress.
  • Avoid retrying client-side errors (4xx responses such as validation or authentication failures).

Possible Implementation

  • Create an Axios interceptor in frontend/src/api/axiosConfig.js.
  • Configure retry attempts (e.g., 3 retries).
  • Add user feedback through toast notifications or loading indicators.

Benefits

  • Improved reliability for users.
  • Better handling of Render cold starts.
  • Reduced frustration caused by temporary backend unavailability.
  • Smoother onboarding experience for new users.

Additional Context

The project documentation already notes that the deployed backend may take 30–60 seconds to wake up after inactivity. Adding retry handling would help mitigate this limitation and improve overall user experience.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions