-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ready event not emitted if shard reconnects after final shard initialization #10485
Comments
Can you elaborate on what exactly happens when you encounter that issue? Especially why the shard needs to reconnect. Because regular reconnects should emit the If you by any chance have |
This happens on the initial boot up. If a shard closes and attempts to resume, but becomes marked as ready after the final shard (shard 70), then the ready event is never emitted as the check to emit the ready event happens when shard 70 is marked as ready.
|
I would be interested to see all logs for that shard 68 that happened before those you showed too. Because it’s rather weird to have a resume happening that early and I‘d need to know what the shard did before that to trace the status changes in code. |
Where does that |
|
That last line there comes from discord.js/packages/discord.js/src/client/websocket/WebSocketShard.js Lines 173 to 184 in 8a74f14
AllReady event which gets handled here
discord.js/packages/discord.js/src/client/websocket/WebSocketManager.js Lines 185 to 194 in 8a74f14
running the check if all shards are ready. That check is run independent of if the id of the shard is the one of the last shard. There's something missing in the information you provide us with here. Would help if your log there also included |
|
Can you send your client options here too? |
const client = new Client({
shards: 'auto',
rest: {
retries: 0,
rejectOnRateLimit: (rateLimitData) => {
return rateLimitData.route.endsWith('/emojis');
}
},
makeCache: Options.cacheWithLimits({
MessageManager: {
maxSize: 10
},
GuildInviteManager: { maxSize: 0 },
GuildEmojiManager: { maxSize: 0 },
GuildStickerManager: { maxSize: 0 }
}),
sweepers: {
...Options.DefaultSweeperSettings,
messages: {
interval: 120,
lifetime: 120
}
},
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.MessageContent
],
partials: [
Partials.Message,
Partials.Reaction,
Partials.Channel,
Partials.GuildMember
],
presence: {
activities: [
{
name: '/help',
type: ActivityType.Listening
}
]
}
}); |
Do you have any other code that uses |
Nope. I did reboot the bot several times within a short window of about 15-20 minutes because I forgot to make an important change, so I'm not sure if that had something to do with it. |
Which package is this bug report for?
discord.js
Issue description
If a shard attempts to reconnect but doesn't fully do so before the final shard becomes ready, the
ready
event won't be emitted. For example, with 10 shards, if shard 6 reconnects and becomes ready after shard 10 is ready, theready
event won’t fire, although all shards are ready. The only way to resolve this issue is to reboot the bot and hope the same situation doesn't occur.Code sample
No response
Versions
djs 14.16.1
node LTS
Issue priority
Medium (should be fixed soon)
Which partials do you have configured?
Not applicable
Which gateway intents are you subscribing to?
Not applicable
I have tested this issue on a development release
yes
The text was updated successfully, but these errors were encountered: