pnp / pnpjs

Fluent JavaScript API for SharePoint and Microsoft Graph REST APIs
https://pnp.github.io/pnpjs/
Other
742 stars 302 forks source link

Custom Http request to pull RateLimit-Reset header #3026

Closed jonathanhotono closed 2 months ago

jonathanhotono commented 2 months ago

What version of PnPjs library you are using

3.x

Minor Version Number

3.23.0

Target environment

All

Additional environment details

SPFx PnPJS

Question/Request

I am working to execute a huge number of requests, I need to process all PnPJS request raw response header to pull RateLimit-Reset value and store it into a variable to delay subsequent requests. Is there any way to override the http request behaviour to alter the before/after sending http request?

I understand that we could easily do try catch for 429 error, but it would be better to handle the RateLimit-Reset header provided before the actual 429 error actually happens on subsequent requests.

patrick-rodgers commented 2 months ago

The library already includes retry logic. If you need to do something else you'd likely need to write a new send implementation similar to this.

juliemturner commented 2 months ago

I'm going to close this issue as answered. If you have further issues, please feel free to create a new issue and reference this one.

github-actions[bot] commented 1 month ago

This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.