allow shards to spawn one at a time

This commit is contained in:
Erik 2023-12-10 22:47:11 +02:00
parent f87b9276ea
commit 9446a4dc89
3 changed files with 6 additions and 5 deletions

View File

@ -1,4 +1,4 @@
import { GuildBasedChannel, Message } from 'discord.js';
import { GuildBasedChannel, GuildTextBasedChannel, Message } from 'discord.js';
import { GuildWrapper, InvokerWrapper, MemberWrapper, UserWrapper } from '../src/client/components/wrappers/index.ts';
import { CommandOption, Infraction } from '../src/client/interfaces/index.ts';
import { FormatParams, InfractionType } from './Client.ts';

View File

@ -182,7 +182,7 @@ class ModerationManager implements Initialisable
const response = await this._handleTarget(Infraction, target, {
invoker,
guild: invoker.guild!,
channel: invoker.channel,
channel: invoker.channel as GuildTextBasedChannel,
executor,
arguments: args,
points: args.points?.asNumber,

View File

@ -133,14 +133,15 @@ class Controller extends EventEmitter
throw new TypeError('Amount of shards must be an integer.');
}
const promises = [];
// const promises = [];
for (let i = 0; i < shardCount; i++)
{
const shard = this.createShard(shardCount);
promises.push(shard.spawn());
await shard.spawn(90_000);
// promises.push();
}
await Promise.all(promises);
// await Promise.all(promises);
this.#logger.status(`Shards spawned, spawned ${this.#shards.size} shards. Took ${Date.now() - start} ms`);