Skip to content

Retry headers#94

Merged
MattCCC merged 4 commits intomasterfrom
retry-headers
Jul 19, 2025
Merged

Retry headers#94
MattCCC merged 4 commits intomasterfrom
retry-headers

Conversation

@MattCCC
Copy link
Owner

@MattCCC MattCCC commented Jul 18, 2025

This pull request introduces enhancements to the retry logic for handling rate-limiting scenarios and updates the package.json configuration. The key changes include improving the handling of HTTP headers for calculating retry delays, adding support for additional rate-limiting headers, and updating the library's size limits and type definitions.

Improvements to Retry Logic:

  • Added a new utility function getMsFromHttpDate to parse HTTP-date strings into milliseconds, ensuring proper handling of Retry-After headers. (src/retry-handler.ts, src/retry-handler.tsR6-R14)
  • Enhanced the getRetryAfterMs function to handle additional rate-limiting headers such as ratelimit-reset-after and ratelimit-reset-at for more robust retry delay calculations. (src/retry-handler.ts, src/retry-handler.tsL20-R74)
  • Updated the withRetry function to handle HTTP 503 (Service Unavailable) errors in addition to HTTP 429 (Too Many Requests) for rate-limiting scenarios. (src/retry-handler.ts, src/retry-handler.tsL142-R178)

Updates to package.json:

  • Added type definitions for the main export and the React-specific export to improve TypeScript support. (package.json, [1] [2]
  • Increased the size limits for the browser and Node.js distributions to reflect recent changes in the codebase. (package.json, package.jsonL72-R82)

@MattCCC MattCCC self-assigned this Jul 18, 2025
@github-actions
Copy link

github-actions bot commented Jul 18, 2025

size-limit report 📦

Path Size
dist/browser/index.mjs 5.38 KB (+2% 🔺)
dist/browser/index.global.js 5.55 KB (+2.12% 🔺)
dist/node/index.js 5.46 KB (+1.96% 🔺)
dist/react/index.mjs 8.42 KB (+1.2% 🔺)
dist/react/index.js 9.13 KB (+1.18% 🔺)

@MattCCC MattCCC added bug Something isn't working enhancement New feature or request labels Jul 18, 2025
@MattCCC
Copy link
Owner Author

MattCCC commented Jul 19, 2025

Thanks @red-game-dev ! I'm going to merge soon. I'm going to prioritize this as we fix a small typings bug in the imports after 4.0.0, so probably 4.0.1

@red-game-dev
Copy link
Collaborator

red-game-dev commented Jul 19, 2025

Thanks @red-game-dev ! I'm going to merge soon. I'm going to prioritize this as we fix a small typings bug in the imports after 4.0.0, so probably 4.0.1

Perfect. Glad to see the package is improving. Hopefully people doesnt judge it by number of downloads, but actually try it, since at this point this package is super optimized and it is simple to use.

Furthermore I may not be able to conduct reviews or contributing anymore soon as seems companies are starting not to be in favour of this for people to contribute or review in open source or even having side projects. Perhaps in the future I'll be able the help again 🙏

Cheers for making this package an amazing one 🚀

@MattCCC MattCCC merged commit 203018f into master Jul 19, 2025
10 checks passed
@MattCCC MattCCC deleted the retry-headers branch July 19, 2025 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants