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:
DD 2023-05-05 23:14:53 +03:00 committed by GitHub
parent ab39683a50
commit 00da44a120
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -229,7 +229,6 @@ test('strategies', async () => {
await manager.destroy(destroyOptions);
expect(strategy.destroy).toHaveBeenCalledWith(destroyOptions);
// eslint-disable-next-line id-length
const send: GatewaySendPayload = {
op: GatewayOpcodes.RequestGuildMembers,
// eslint-disable-next-line id-length

View file

@ -259,6 +259,9 @@ export class WebSocketShard extends AsyncEventEmitter<WebSocketShardEventsMap> {
this.#status = WebSocketShardStatus.Idle;
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();
}
}