bwmarrin / discordgo

(Golang) Go bindings for Discord
BSD 3-Clause "New" or "Revised" License
5.07k stars 806 forks source link

No `/api/gateway` ratelimits? #715

Open Cynosphere opened 4 years ago

Cynosphere commented 4 years ago

I'm indirectly using this library through matterbridge and durring the connection issues on Dec 15, 2019, I had matterbridge and my bot running in a different language entirely attempting to reconnect to the gateway during this incident. This ended up getting me ratelimited on a Cloudflare level, even with my bot turned off (and I couldn't shut down matterbridge as its on another user I don't have access to).

Is there no ratelimit for grabbing the gateway URL? I doubt I can blame Eris as it has a 30 second wait period between reconnections plus it only grabs the gateway URL once a session.

Extra: "error code: 1015" when trying to curl gateway "1015 is Cloudflare's version of a 429"

bwmarrin commented 4 years ago

DiscordGo will self ratelimit re-connect attempts, it increments the reconnect delay each time it fails until it reaches a max value of 10 minutes per attempt.

See https://github.com/bwmarrin/discordgo/blob/master/wsapi.go#L827