Skip to content
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

fix(WebSocketShard): mark shard ready if no guilds intent #6284

Merged
merged 2 commits into from Aug 3, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/client/websocket/WebSocketShard.js
Expand Up @@ -474,17 +474,23 @@ class WebSocketShard extends EventEmitter {
this.emit(ShardEvents.ALL_READY);
return;
}
let time = 15000;
if (!new Intents(this.manager.client.options.intents).has(Intents.FLAGS.GUILDS)) {
time = 0;
}
ckohen marked this conversation as resolved.
Show resolved Hide resolved
// Step 2. Create a 15s timeout that will mark the shard as ready if there are still unavailable guilds
this.readyTimeout = setTimeout(() => {
this.debug(`Shard did not receive any more guild packets in 15 seconds.
Unavailable guild count: ${this.expectedGuilds.size}`);
this.debug(
`Shard ${time === 0 ? 'will' : 'did'} not receive any more guild packets` +
`${time === 0 ? '' : ' in 15 seconds'}.\n Unavailable guild count: ${this.expectedGuilds.size}`,
ckohen marked this conversation as resolved.
Show resolved Hide resolved
);

this.readyTimeout = null;

this.status = Status.READY;

this.emit(ShardEvents.ALL_READY, this.expectedGuilds);
}, 15000).unref();
}, time).unref();
}

/**
Expand Down