feat(ws): custom workers (#9004)

* feat(ws): custom workers

* chore: typo

* refactor(WebSocketShard): expose shard id

* chore: remove outdated readme comment

* chore: nits

* chore: remove unnecessary mutation

* feat: fancier resolution

* chore: remove unnecessary exports

* chore: apply suggestions

* refactor: use range errors

Co-authored-by: Aura Román <kyradiscord@gmail.com>
This commit is contained in:
DD
2023-01-10 19:31:56 +02:00
committed by GitHub
parent 39c4de2dbc
commit 828a13b526
11 changed files with 343 additions and 159 deletions

View File

@@ -67,7 +67,10 @@ export class SimpleShardingStrategy implements IShardingStrategy {
*/
public async send(shardId: number, payload: GatewaySendPayload) {
const shard = this.shards.get(shardId);
if (!shard) throw new Error(`Shard ${shardId} not found`);
if (!shard) {
throw new RangeError(`Shard ${shardId} not found`);
}
return shard.send(payload);
}