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): don't await #destroy in error bubbling logic #9276

Merged
merged 4 commits into from
Mar 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/ws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pnpm add @discordjs/ws
## Example usage

```ts
import { WebSocketManager, WebSocketShardEvents } from '@discordjs/ws';
import { WebSocketManager, WebSocketShardEvents, CompressionMethod } from '@discordjs/ws';
import { REST } from '@discordjs/rest';

const rest = new REST().setToken(process.env.DISCORD_TOKEN);
Expand All @@ -48,6 +48,8 @@ const manager = new WebSocketManager({
token: process.env.DISCORD_TOKEN,
intents: 0, // for no intents
rest,
// uncomment if you have zlib-sync installed and want to use compression
// compression: CompressionMethod.ZlibStream,
});

manager.on(WebSocketShardEvents.Dispatch, (event) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/ws/src/ws/WebSocketShard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export class WebSocketShard extends AsyncEventEmitter<WebSocketShardEventsMap> {
}

// If the error is handled, we can just try to reconnect
await this.destroy({
void this.destroy({
code: CloseCodes.Normal,
reason: 'Something timed out or went wrong while waiting for an event',
recover: WebSocketShardDestroyRecovery.Reconnect,
Expand Down