Skip to content

Commit

Permalink
chore: eslint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Deivu committed Jul 20, 2023
1 parent a106618 commit aecac05
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/Indomitable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -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 {
Expand All @@ -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;
Expand All @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/Util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Https, { RequestOptions } from 'node:https';
import Cluster from "node:cluster";

/**
* Hoisted Environmental Variable for ease of fetching
Expand Down
2 changes: 1 addition & 1 deletion src/client/ShardClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions src/ipc/BaseIpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions src/ipc/BaseWorker.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit aecac05

Please sign in to comment.