How can I go under the rate limit with the httpqueue API?

I dont know if anyone is fimiliar with the httpqueue API but heres a link if anyone is interested.

Anywho the issue is I’ve been using this plugin and although it works I was wondering if there was a way to go UNDER the discord webhook rate limit using it (or other means).

I was told that if you constantly spam discord webhooks at the rate limit its still considered abuse and you can get your account terminated for that. So my solution would be to simply make a limit below the rate limit so its not considered abuse. But I’m not exactly sure how I could achieve this.

You probably should consider that Discord doesn’t have exactly one rate limit, see Discord Developer Portal. So if you’re using more than one endpoint, it’s possible you’ll need more than one queue.

On the other hand, you’ll need to understand that a server X will not know how many requests server Y is sending, and vice-versa. If your experience spans multiple servers and a single server is expected to send a lot of requests (i.e. regardless of how many players are in that server) per second, you might want to consider a different solution other than Discord.

Now, there will always be some ways to mitigate this: If you find yourself sending a lot of requests (so that you’re at risk of hitting the limits), you can create a queue of size 1. This means that a request is only sent after the one in front has been replied to and confirmed not to be a 429.

local Http = require(--[[module location]])
local discordQueue = Http.HttpQueue.new({
    maxSimultaneousSendOperations = 1,
    -- backoff method, at your choice - fixed, header, or callback
})

The complete usage documentation can be found here.

The advantage is that you’ll send less invalid requests (at most one 429 before the queue enters in “cooldown” mode).

This will also mean, of course, that requests will take longer to process. Make sure you’re not adding more requests than the amount of requests the queue can process.

While I admit that there’s not a definitive answer to your problem - as I’m not aware of how you intend to use their webhook service, I hope these pointers can help you.

Cheers,
davness

2 Likes