Virtus
Explore posts from serversDIAdiscord.js - Imagine an app
•Created by Virtus on 6/21/2023 in #djs-questions
How does RequestManager work?
I was looking at the source for
@discordjs/rest
to see if I should stop the sweepers (since I only use REST, trying to keep it stateless) when I noticed sweepers that look like they handle sweeping RequestManager. I was wondering why this was needed, and looked further and found handling related to bucketing for rate-limiting (I think).
I was wondering if someone could either explain, correct me, or confirm my understanding of how this system works?
First of all there's not one giant RequestManager that deal with all the requests, but rather smaller units?
In order to deal with Discord having endpoints it considers being "different" and those having different rate limits and groupings (buckets), the Request manager will try to create some sort of hash from the input route.
We use this hash to get a small request handler unit, and if not found, we create one and cache it. The request is then queued into this handler.
Each smaller handler deals with one bucket, in order to keep tracking of rate limits easily manageable.
After a certain interval, sweepers will go through the cache of these smaller handlers and remove any inactive ones, or ones that are too old?5 replies
DIAdiscord.js - Imagine an app
•Created by Virtus on 3/6/2023 in #djs-questions
No `Ready` event dispatached
I am using
@discordjs/ws
version 0.6.0
, and @discord/rest
version 1.5.0
.
It seems like I am not receiving the ready
event. I do receive a bunch of GUILD_CREATE
on startup, as well as other events, like messages, guild members, etc..
File: index.js
File: controller.js
3 replies