mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 13:03:31 +01:00
fix(WebSocketShard): wait a little before reconnecting (#9517)
* fix(WebSocketShard): wait a little before reconnecting * chore: leftover comment --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -229,7 +229,6 @@ test('strategies', async () => {
|
|||||||
await manager.destroy(destroyOptions);
|
await manager.destroy(destroyOptions);
|
||||||
expect(strategy.destroy).toHaveBeenCalledWith(destroyOptions);
|
expect(strategy.destroy).toHaveBeenCalledWith(destroyOptions);
|
||||||
|
|
||||||
// eslint-disable-next-line id-length
|
|
||||||
const send: GatewaySendPayload = {
|
const send: GatewaySendPayload = {
|
||||||
op: GatewayOpcodes.RequestGuildMembers,
|
op: GatewayOpcodes.RequestGuildMembers,
|
||||||
// eslint-disable-next-line id-length
|
// eslint-disable-next-line id-length
|
||||||
|
|||||||
@@ -259,6 +259,9 @@ export class WebSocketShard extends AsyncEventEmitter<WebSocketShardEventsMap> {
|
|||||||
this.#status = WebSocketShardStatus.Idle;
|
this.#status = WebSocketShardStatus.Idle;
|
||||||
|
|
||||||
if (options.recover !== undefined) {
|
if (options.recover !== undefined) {
|
||||||
|
// There's cases (like no internet connection) where we immediately fail to connect,
|
||||||
|
// causing a very fast and draining reconnection loop.
|
||||||
|
await sleep(500);
|
||||||
return this.internalConnect();
|
return this.internalConnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user