Linter pass
This commit is contained in:
parent
794317986e
commit
85869b4b0c
@ -85,6 +85,13 @@
|
||||
// ],
|
||||
"max-classes-per-file": "warn",
|
||||
"max-nested-callbacks": "warn",
|
||||
"max-len": ["warn", {
|
||||
"code": 140,
|
||||
"ignoreComments": true,
|
||||
"ignoreStrings": true,
|
||||
"ignoreTemplateLiterals": true,
|
||||
"ignoreRegExpLiterals": true
|
||||
}],
|
||||
"new-parens": "warn",
|
||||
"no-alert": "warn",
|
||||
"no-array-constructor": "warn",
|
||||
|
@ -8,8 +8,7 @@ import path from 'node:path';
|
||||
|
||||
// External
|
||||
import { MasterLogger } from '@navy.gif/logger';
|
||||
import { Parser } from '@navy.gif/commandparser';
|
||||
const CommandParser = Parser;
|
||||
import { Parser as CommandParser } from '@navy.gif/commandparser';
|
||||
import { Collection } from '@discordjs/collection';
|
||||
|
||||
// Local
|
||||
@ -28,7 +27,7 @@ class Controller extends EventEmitter {
|
||||
#_options: ControllerOptions;
|
||||
#_built: boolean;
|
||||
#_logger: MasterLogger;
|
||||
#_parser?: Parser;
|
||||
#_parser?: CommandParser;
|
||||
|
||||
#_serverFilePath: string;
|
||||
#_shards: Collection<number, Shard>;
|
||||
@ -91,7 +90,15 @@ class Controller extends EventEmitter {
|
||||
async init (): Promise<void> {
|
||||
|
||||
this.#_logger.info(`Initialising Controller`);
|
||||
const { projectName, shardCount = 1, shardOptions = {}, serverOptions = {} as ServerOptions, logger = {}, discord = {}, databases = {} } = this.#_options;
|
||||
const {
|
||||
projectName,
|
||||
shardCount = 1,
|
||||
shardOptions = {},
|
||||
serverOptions = {} as ServerOptions,
|
||||
logger = {},
|
||||
discord = {},
|
||||
databases = {}
|
||||
} = this.#_options;
|
||||
this.#_logger.info(`Spawning ${shardCount} shards`);
|
||||
|
||||
serverOptions.name = projectName;
|
||||
@ -120,7 +127,14 @@ class Controller extends EventEmitter {
|
||||
|
||||
const promises = [];
|
||||
for (let i = 0; i < shardCount; i++) {
|
||||
const shard = new Shard(this, i, { serverOptions: { ...serverOptions, logger, discord, databases }, ...shardOptions, env: this.#_options.env, path: this.#_serverFilePath });
|
||||
const shard = new Shard(this, i, {
|
||||
serverOptions: {
|
||||
...serverOptions, logger, discord, databases
|
||||
},
|
||||
...shardOptions,
|
||||
env: this.#_options.env,
|
||||
path: this.#_serverFilePath
|
||||
});
|
||||
this.#_logger.attach(shard);
|
||||
this._setListeners(shard);
|
||||
this.#_shards.set(i, shard);
|
||||
|
@ -93,7 +93,13 @@ class Shard extends EventEmitter {
|
||||
if (this.process)
|
||||
throw new Error(`[shard-${this.id}] A process for this shard already exists!`);
|
||||
|
||||
this.#_process = fork(this.#_filePath, this.#_args, { env: { ...this.#_env, SHARD_ID: this.id.toString() }, execArgv: this.#_execArgv })
|
||||
this.#_process = fork(this.#_filePath, this.#_args, {
|
||||
env: {
|
||||
...this.#_env,
|
||||
SHARD_ID: this.id.toString()
|
||||
},
|
||||
execArgv: this.#_execArgv
|
||||
})
|
||||
.on('message', this._handleMessage.bind(this))
|
||||
.on('exit', this._handleExit.bind(this))
|
||||
.on('disconnect', this._handleDisconnect.bind(this)); // Don't know if this is going to help, but monitoring whether this gets called whenever a process on its own closes the IPC channel
|
||||
|
@ -61,7 +61,11 @@ class Authenticator {
|
||||
* }
|
||||
* @memberof Authenticator
|
||||
*/
|
||||
constructor (server: Server, users: UserDatabaseInterface, { sessionStorage, secret, name, cookie = { } }: {sessionStorage: MongoStore, secret: string, name: string, cookie: Cookie}) {
|
||||
constructor (
|
||||
server: Server,
|
||||
users: UserDatabaseInterface,
|
||||
{ sessionStorage, secret, name, cookie = {} }: { sessionStorage: MongoStore, secret: string, name: string, cookie: Cookie }
|
||||
) {
|
||||
|
||||
// if (!(users instanceof UserDatabaseInterface))
|
||||
// Util.fatal(new Error(`Expecting user database to be an instance inheriting UserDatabaseInterface`));
|
||||
|
Loading…
Reference in New Issue
Block a user