Skip to content

Conversation

@RayBB
Copy link
Collaborator

@RayBB RayBB commented Jul 23, 2025

@github-project-automation github-project-automation bot moved this to Waiting Review/Merge from Staff in Ray's Project Jul 23, 2025
@RayBB RayBB requested a review from cdrini July 23, 2025 04:26
Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

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

Nice this looks like a good approach! A few fixes/comments.

// This block catches network errors (e.g., DNS, connection refused) and the server errors we threw above.
}
const backoff = Math.pow(2, attempt) * initialDelay;
const jitter = Math.random() * backoff;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it make more sense to have the jitter be based only on the initialDelay without the exponential? That should avoid it having a range up to 2x the backoff.

// TODO: this line is just for testing locally, remove before merging
CONFIGS.OL_BASE_BOOKS = 'https://openlibrary.org'

export async function fetchWithRetry(resource, options = {}, maxRetries = 5, initialDelay = 5000) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you experiment with 1500 or 2000 as the default? Does that work?

Suggested change
export async function fetchWithRetry(resource, options = {}, maxRetries = 5, initialDelay = 5000) {
export async function fetchWithRetry(resource, options = {}, maxRetries = 5, initialDelay = 1500) {

@RayBB RayBB marked this pull request as ready for review July 25, 2025 06:28
@RayBB RayBB requested a review from cdrini July 25, 2025 06:28
@RayBB
Copy link
Collaborator Author

RayBB commented Jul 25, 2025

@cdrini this one has incorporated all your feedback and is ready for another review. Seems to work quite well with the little check on the last 429 seen

@cdrini cdrini merged commit 2439a5c into master Aug 12, 2025
8 checks passed
@github-project-automation github-project-automation bot moved this from Waiting Review/Merge from Staff to Done in Ray's Project Aug 12, 2025
@cdrini cdrini deleted the feature/merge-ui-fetch-with-retry branch August 12, 2025 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Impossible to merge works - web client should respect rate limits

3 participants