refactor(WebSocketManager): passing in strategy (#9122)

* refactor(WebSocketManager): passing in strategy

* chore: update tests

* chore: requested nits

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
DD
2023-02-19 20:57:31 +02:00
committed by GitHub
parent c6f9c50ba9
commit 5c5a5832b9
5 changed files with 39 additions and 26 deletions

View File

@@ -2,6 +2,7 @@ import process from 'node:process';
import { Collection } from '@discordjs/collection';
import { lazy } from '@discordjs/util';
import { APIVersion, GatewayOpcodes } from 'discord-api-types/v10';
import { SimpleShardingStrategy } from '../strategies/sharding/SimpleShardingStrategy.js';
import type { SessionInfo, OptionalWebSocketManagerOptions } from '../ws/WebSocketManager.js';
import type { SendRateLimitState } from '../ws/WebSocketShard.js';
@@ -27,6 +28,7 @@ const getDefaultSessionStore = lazy(() => new Collection<number, SessionInfo | n
* Default options used by the manager
*/
export const DefaultWebSocketManagerOptions = {
buildStrategy: (manager) => new SimpleShardingStrategy(manager),
shardCount: null,
shardIds: null,
largeThreshold: null,