Closed bkuhl closed 4 years ago
More details from Discord:
Dr. abal: 99.99% sure your issue is https://github.com/bwmarrin/discordgo/blob/b3cc83b/wsapi.go#L860 needs to be FormatCloseMessage(4000, "") for OP7
Dr. Abal: the Close() call at https://github.com/bwmarrin/discordgo/blob/b3cc83b/wsapi.go#L501
I am not fully aware of the entire system however from a quick glance at Jonas' own fork of discordgo, maybe this helps : https://github.com/jonas747/discordgo/commit/f74e48b2d28a5b2f60c42e97282d5031bf059ff2
Ahh, you're right, this seems to be a DiscordGo issue. I'll create an issue over there: https://github.com/bwmarrin/discordgo/issues/759
TBH, I'm not 100% if this is a DiscordGo issue or something with the Shard Manager. I suspect it's this package so I'll create the issue here.
The Problem Changes to Discord's socket handling this past Thursday caused any bots using this package at scale (may apply to lower usage as well, I'm not sure 100+) get their bot tokens forcibly reset by Discord due to too many authentication requests.
Both myself and another user of this package with 100+ shards are experiencing this consistent resetting.
What Happened & The Fix This past Thursday, Discord rolled out a change to their API where shards should be expected to reconnect to the gateway in response to an event to enable the ability for Discord to more gracefully handling transferring active sessions to new hosts and such.
Here's the announcement from Discord:
Dont panic
Discord is rolling out a software update to our gateways. We anticipate no issues, and have had a canary of the new code running for a while now with no issue. This update introduces only one user visible change.
Your gateway connection will regularly be asked to reconnect using opcode: https://discordapp.com/developers/docs/topics/gateway#reconnect
You can simply reconnect and resume as you would tolerate the gateway connection being interrupted via other causes. We are doing this to allow for organic rebalancing of long-lived connections between nodes as nodes eventually start to auto-scale in/out.