#Weird global-but-not-global rate limits

1 messages · Page 1 of 1 (latest)

lucid parrot
#

Hi, our Discord bot has been hitting some odd and pretty problematic rate limits lately, and we can't for the life of us figure out what's going on. I was wondering if anyone might have any ideas or experience with something similar.

Our bot is in ~4000 servers and does ~800 commands per day, so not very big. We run discord.js with 4 shards, so for ratelimiting we run everything through a @discordjs/proxy (and we use this to monitor requests as well). This all runs on a DigitalOcean droplet, so every request to Discord from our bot's token runs through the proxy and comes from this IP, which isn't shared with anything else. So no shared IP issues.

Occasionally (about 5 times now over the past month or so) our bot seems to hit some kind of global ratelimit, in the sense that it affects every single request but is not marked as global. Global always comes through as false, the limit is Infinity and time to reset is 50ms (which I believe is added by @discordjs/rest). Initially this would cause an infinite loop because djs can't handle it properly, which would then get us cloudflare banned by 429s, but I've added a mechanism to detect and kill these loops before that happens. It happens across every single endpoint - interaction responses, application command permissions, even just fetching users.

It happened most recently yesterday, and I've attached a screenshot showing which endpoints were hit and how many times in the 24 hours surrounding when it happened. It's a really tame number of requests - around 2500 in the 24 hours - so I would never expect there to be rate limit issues. There were no spikes either, the most requests we ever sent in a 3 minute period were 53.

So yeah, this has us super confused. If anyone has any ideas or suggestions for what to look into, I'd really appreciate it. It's nearly impossible to predict when it will happen (except always when I'm asleep :/) and since it's only happened 5 times it's quite hard to debug.

lean panther
#

Do you happen to have a log of requests that failed/errored? you can get globally ratelimited for hitting errors too often