Skip to content

Conversation

tommaso1
Copy link
Collaborator

@tommaso1 tommaso1 commented Jul 1, 2025

…s and metadata. Added exponential backoff for retries and improved error logging. Updated subproject commit to indicate a dirty state.

List of Changes

  • Added configurable retry logic to downloadFileAsText() and fetchMetadataFromCDN() functions
  • Implemented exponential backoff with configurable retry attempts and delay timing
  • Added environment variables CDN_RETRY_ATTEMPTS (default: 3) and CDN_RETRY_DELAY_MS (default: 5000ms)
  • Improved error handling and logging for CDN fetch failures
  • Fixes issues where guide pages would show 404 errors when CloudFront cache was not warmed up

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Chore (nothing changes by a user perspective)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

…s and metadata. Added exponential backoff for retries and improved error logging. Updated subproject commit to indicate a dirty state.
- Implemented retry logic with exponential backoff for `downloadFileAsText()` and `fetchMetadataFromCDN()`
- Introduced environment variables `CDN_RETRY_ATTEMPTS` and `CDN_RETRY_DELAY_MS` for customization
- Enhanced error handling and logging for CDN fetch failures
- Resolved 404 errors on guide pages when CloudFront cache is not warmed up
Copy link

changeset-bot bot commented Jul 1, 2025

🦋 Changeset detected

Latest commit: 70a2d25

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nextjs-website Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines 64 to 76
if (attempt < RETRY_ATTEMPTS) {
const delayMs = INITIAL_RETRY_DELAY_MS * Math.pow(2, attempt - 1); // Exponential backoff
console.log(`Retrying in ${delayMs}ms...`);
await delay(delayMs);
}
}
}

console.error(
`Failed to download file after ${RETRY_ATTEMPTS} attempts:`,
lastError
);
return;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isntead of duplicate code for retry maybe we can have a shared function that handle retries used in both downloadFileAsText and fetchMetadataFromCDN

- Introduced a `withRetries` function to handle retry logic for asynchronous operations, enhancing code reusability.
- Updated `downloadFileAsText` and `fetchMetadataFromCDN` to leverage the new retry function, improving error handling and logging.
- Maintained existing functionality while streamlining the retry process for better maintainability.
Copy link
Contributor

github-actions bot commented Jul 2, 2025

Jira Pull Request Link

This Pull Request refers to the following Jira issue DEV-2397

Copy link
Contributor

github-actions bot commented Jul 2, 2025

Branch is not up to date with base branch

@tommaso1 it seems this Pull Request is not updated with base branch.
Please proceed with a merge or rebase to solve this.

@MarcoPonchia MarcoPonchia merged commit daab8fc into main Jul 3, 2025
14 of 16 checks passed
@MarcoPonchia MarcoPonchia deleted the DEV-2397 branch July 3, 2025 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants