mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
Rename spawnArgs -> shardArgs
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -10,9 +10,9 @@ class Shard {
|
|||||||
/**
|
/**
|
||||||
* @param {ShardingManager} manager The sharding manager
|
* @param {ShardingManager} manager The sharding manager
|
||||||
* @param {number} id The ID of this shard
|
* @param {number} id The ID of this shard
|
||||||
* @param {array} [spawnArgs=[]] Command line arguments to pass to the shard
|
* @param {array} [args=[]] Command line arguments to pass to the script
|
||||||
*/
|
*/
|
||||||
constructor(manager, id, spawnArgs = []) {
|
constructor(manager, id, args = []) {
|
||||||
/**
|
/**
|
||||||
* Manager that created the shard
|
* Manager that created the shard
|
||||||
* @type {ShardingManager}
|
* @type {ShardingManager}
|
||||||
@@ -39,7 +39,7 @@ class Shard {
|
|||||||
* Process of the shard
|
* Process of the shard
|
||||||
* @type {ChildProcess}
|
* @type {ChildProcess}
|
||||||
*/
|
*/
|
||||||
this.process = childProcess.fork(path.resolve(this.manager.file), spawnArgs, {
|
this.process = childProcess.fork(path.resolve(this.manager.file), args, {
|
||||||
env: this.env,
|
env: this.env,
|
||||||
});
|
});
|
||||||
this.process.on('message', this._handleMessage.bind(this));
|
this.process.on('message', this._handleMessage.bind(this));
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class ShardingManager extends EventEmitter {
|
|||||||
* @param {number} [options.autoShardInterval=600] How frequently to automatically spawn another shard if needed
|
* @param {number} [options.autoShardInterval=600] How frequently to automatically spawn another shard if needed
|
||||||
* (in seconds) - only applicable if `totalShards` is `auto`
|
* (in seconds) - only applicable if `totalShards` is `auto`
|
||||||
* @param {boolean} [options.respawn=true] Whether shards should automatically respawn upon exiting
|
* @param {boolean} [options.respawn=true] Whether shards should automatically respawn upon exiting
|
||||||
* @param {string[]} [options.spawnArgs=[]] Arguments to pass to the shard script when spawning
|
* @param {string[]} [options.shardArgs=[]] Arguments to pass to the shard script when spawning
|
||||||
* @param {string} [options.token] Token to use for automatic shard count and passing to shards
|
* @param {string} [options.token] Token to use for automatic shard count and passing to shards
|
||||||
*/
|
*/
|
||||||
constructor(file, options = {}) {
|
constructor(file, options = {}) {
|
||||||
@@ -30,7 +30,7 @@ class ShardingManager extends EventEmitter {
|
|||||||
totalShards: 'auto',
|
totalShards: 'auto',
|
||||||
autoShardInterval: 600,
|
autoShardInterval: 600,
|
||||||
respawn: true,
|
respawn: true,
|
||||||
spawnArgs: [],
|
shardArgs: [],
|
||||||
token: null,
|
token: null,
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ class ShardingManager extends EventEmitter {
|
|||||||
* An array of arguments to pass to shards.
|
* An array of arguments to pass to shards.
|
||||||
* @type {string[]}
|
* @type {string[]}
|
||||||
*/
|
*/
|
||||||
this.spawnArgs = options.spawnArgs;
|
this.shardArgs = options.shardArgs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Token to use for obtaining the automatic shard count, and passing to shards
|
* Token to use for obtaining the automatic shard count, and passing to shards
|
||||||
@@ -109,7 +109,7 @@ class ShardingManager extends EventEmitter {
|
|||||||
* @returns {Promise<Shard>}
|
* @returns {Promise<Shard>}
|
||||||
*/
|
*/
|
||||||
createShard(id = this.shards.size) {
|
createShard(id = this.shards.size) {
|
||||||
const shard = new Shard(this, id, this.spawnArgs);
|
const shard = new Shard(this, id, this.shardArgs);
|
||||||
this.shards.set(id, shard);
|
this.shards.set(id, shard);
|
||||||
/**
|
/**
|
||||||
* Emitted upon launching a shard
|
* Emitted upon launching a shard
|
||||||
|
|||||||
Reference in New Issue
Block a user