discordjs / discord.js

A powerful JavaScript library for interacting with the Discord API
https://discord.js.org
Apache License 2.0
25.36k stars 3.97k forks source link

Rate limiting on Post #4329

Closed Golorio closed 3 years ago

Golorio commented 4 years ago

Please describe the problem you are having in as much detail as possible: I started listening to the debug event and it seems I am close to getting rate limited by Discord since I receive about 9k+ 429s. The rate limits occur in post messages 99% percent of the time. I do not use a loop, have a webhook, use a channel as a log etc. A player sends a request my bot replies.

I changed the debug line https://github.com/discordjs/discord.js/blob/stable/src/rest/RequestHandler.js#L151 to:

this.manager.client.emit('debug', `429 hit on route ${item.request.method}:${item.request.route} with options ${JSON.stringify(item.request.options)}`);

And got (removed IDs):

429 hit on route post:/channels/...................../messages with options {"versioned":true,"route":"/channels/............./messages","data":{"tts":false,"embed":{"type":"rich","description":"...........","timestamp":null,"color":5720738,"fields":[],"thumbnail":{"url":"https://cdn.discordapp.com/emojis/............png"},"image":null,"author":{"name":"......","icon_url":"https://cdn.discordapp.com/emojis/..........png"},"footer":null},"embeds":[{"type":"rich","description":".............","timestamp":null,"color":5720738,"fields":[],"thumbnail":{"url":"https://cdn.discordapp.com/emojis/........png"},"image":null,"author":{"name":".....","icon_url":"https://cdn.discordapp.com/emojis/..........png"},"footer":null}]},"files":[]}

Include a reproducible code sample here, if possible: None.

Further details:

Rufus1123 commented 4 years ago

As of Sunday (May 31st), I am also encountering a lot of rate limit errors. I was on v11.4.2, switched to v11.6.2 (didn't help) and I am also getting ratelimitting errors on v12.2.0 (though it seems to be better handled)

loonanir commented 4 years ago

im encountering this issue too! im on v12.2.0 and reached the 10k of 429s apparently, this is because the shards do not share the timeout for global rate limits

iCrawl commented 3 years ago

This issue has been stale for a while, if this problem still exists or you can still easily replicate it on v13 (current master or discord.js@dev on NPM), please reopen it as a new issue.