@discord.js/rest pool/bucket stats visibility

I am trying to access the underlying pool stats from the @discordjs/rest package. I currently utilize this package and put the methods behind a proxy (new Proxy(...)) to record the outgoing requests and incoming responses/errors for visibility. My logging (and message broker) is on occasion reporting more requests being sent out than responses are quickly received back. I have limited my code to making requests 20/sec. This shouldn't hit limits, but it's 20/sec constantly and the responses are not coming back in a timely manner (according to my reporting). For helping me debug, I want to access the bucket data that /rest stores internally so I can determine if I am hitting rate limits or if the delayed responses are the result of something else. My current understanding: REST.agent should expose a Dispatcher (docs have a bad link for this class) The Dispatcher, a undici agent should have a stats method to get these pool stats My issue: Typescript (in Deno) complaints about the Dispatcher not having the same contents as the undici agent should. The docs for @discordjs/rest report that it is a undici agent, but have the class Dispatcher (which again, has a bad link so I cannot find good docs on this class). My question: Is there a way to access this bucket that rest uses internally to avoid hitting rate limits?
2 Replies
d.js toolkit
d.js toolkit6mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Amgelo
Amgelo6mo ago
and if you hit ratelimits it emits the rateLimited event which you can use if you want to debug

Did you find this page helpful?