diff --git a/src/Indomitable.ts b/src/Indomitable.ts index 0835750..25c7204 100644 --- a/src/Indomitable.ts +++ b/src/Indomitable.ts @@ -174,7 +174,7 @@ export class Indomitable extends EventEmitter { super(); this.clusterCount = options.clusterCount || 'auto'; this.shardCount = options.shardCount || 'auto'; - this.clientOptions = options.clientOptions || { intents: [1 << 0] }; + this.clientOptions = options.clientOptions || { intents: [ 1 << 0 ] }; this.clusterSettings = options.clusterSettings || {}; this.ipcTimeout = options.ipcTimeout ?? 30000; this.spawnTimeout = options.spawnTimeout ?? 60000; @@ -242,7 +242,7 @@ export class Indomitable extends EventEmitter { if (this.shardCount < this.clusterCount) this.clusterCount = this.shardCount; this.emit(LibraryEvents.DEBUG, `Starting ${this.shardCount} websocket shards across ${this.clusterCount} clusters`); - const shards = [...Array(this.shardCount).keys()]; + const shards = [ ...Array(this.shardCount).keys() ]; const chunks = Chunk(shards, Math.round(this.shardCount / this.clusterCount)); Cluster.setupPrimary({ ...{ serialization: 'json' }, ...this.clusterSettings }); for (let id = 0; id < this.clusterCount; id++) { @@ -304,7 +304,7 @@ export class Indomitable extends EventEmitter { transportable.signal = abortableData.controller.signal; } try { - const results = await Promise.all([...this.clusters.values()].map(cluster => cluster.ipc.send(transportable))); + const results = await Promise.all([ ...this.clusters.values() ].map(cluster => cluster.ipc.send(transportable))); if (!transportable.repliable) return undefined; return results; } finally { @@ -326,7 +326,7 @@ export class Indomitable extends EventEmitter { this.emit(LibraryEvents.DEBUG, `Reconfigured Indomitable to use ${this.shardCount} shard(s)`); const oldClusterCount = Number(this.clusters.size); this.clusterCount = options.clusters || this.clusters.size; - const shards = [...Array(this.shardCount).keys()]; + const shards = [ ...Array(this.shardCount).keys() ]; const chunks = Chunk(shards, Math.round(this.shardCount as number / this.clusterCount)); if (oldClusterCount < this.clusterCount) { const count = this.clusterCount - oldClusterCount; @@ -336,7 +336,7 @@ export class Indomitable extends EventEmitter { } } if (oldClusterCount > this.clusterCount) { - const keys = [...this.clusters.keys()].reverse(); + const keys = [ ...this.clusters.keys() ].reverse(); const range = keys.slice(0, oldClusterCount - this.clusterCount); for (const key of range) { const cluster = this.clusters.get(key); diff --git a/src/Util.ts b/src/Util.ts index 8c24745..446c301 100644 --- a/src/Util.ts +++ b/src/Util.ts @@ -1,5 +1,4 @@ import Https, { RequestOptions } from 'node:https'; -import Cluster from "node:cluster"; /** * Hoisted Environmental Variable for ease of fetching diff --git a/src/client/ShardClient.ts b/src/client/ShardClient.ts index 992fcc9..291b69f 100644 --- a/src/client/ShardClient.ts +++ b/src/client/ShardClient.ts @@ -4,7 +4,7 @@ import { Indomitable } from '../Indomitable'; import { EnvProcessData, ClientEvents, InternalEvents, LibraryEvents } from '../Util'; import { ConcurrencyClient } from '../concurrency/ConcurrencyClient.js'; import { ShardClientUtil } from './ShardClientUtil'; -import { BaseWorker } from "../ipc/BaseWorker"; +import { BaseWorker } from '../ipc/BaseWorker'; export interface PartialInternalEvents { op: ClientEvents, diff --git a/src/ipc/BaseIpc.ts b/src/ipc/BaseIpc.ts index 2383893..2cd046b 100644 --- a/src/ipc/BaseIpc.ts +++ b/src/ipc/BaseIpc.ts @@ -8,7 +8,7 @@ import { RawIpcMessageType, SavePromiseOptions, Transportable } from '../Util.js'; -import {randomUUID} from "crypto"; +import { randomUUID } from 'crypto'; /** * Base class where primary and worker ipc inherits @@ -74,10 +74,10 @@ export abstract class BaseIpc { this.manager.emit(LibraryEvents.RAW, data); if (!(data as any).internal) return; switch((data as RawIpcMessage).type) { - case RawIpcMessageType.MESSAGE: - return await this.handleMessage(data as RawIpcMessage); - case RawIpcMessageType.RESPONSE: - return this.handlePromise(data as RawIpcMessage); + case RawIpcMessageType.MESSAGE: + return await this.handleMessage(data as RawIpcMessage); + case RawIpcMessageType.RESPONSE: + return this.handlePromise(data as RawIpcMessage); } } catch (error: unknown) { errorCallback(error); diff --git a/src/ipc/BaseWorker.ts b/src/ipc/BaseWorker.ts index 6c29856..5e5ad2e 100644 --- a/src/ipc/BaseWorker.ts +++ b/src/ipc/BaseWorker.ts @@ -1,8 +1,7 @@ -import { ChildProcess, Serializable } from 'node:child_process'; -import { randomUUID } from 'crypto'; +import { Serializable } from 'node:child_process'; import { BaseIpc } from './BaseIpc.js'; import { Indomitable } from '../Indomitable'; -import { RawIpcMessage, RawIpcMessageType, Transportable } from '../Util'; +import { RawIpcMessage } from '../Util'; /** * Basic worker ipc class, basic child process ipc handler