Files
discordeno/gateway/calculateMaxShards.ts
Skillz4Killz 2a84ac982e fix: fmt
2022-03-16 02:00:10 +00:00

10 lines
335 B
TypeScript

/** Handler used to determine max number of shards to use based upon the max concurrency. */
export function calculateMaxShards(maxShards: number, maxConcurrency: number): number {
if (maxShards < 100) return maxShards;
return Math.ceil(
maxShards /
(maxConcurrency === 1 ? 16 : maxConcurrency),
) * maxConcurrency;
}