mirror of
https://github.com/danbulant/discord.js
synced 2026-05-29 20:30:38 +00:00
Rewrite sharding class descriptions and link Client
This commit is contained in:
parent
9cd097492c
commit
975da5f1a5
3 changed files with 13 additions and 8 deletions
|
|
@ -6,7 +6,8 @@ const { Error } = require('../errors');
|
|||
const delayFor = require('util').promisify(setTimeout);
|
||||
|
||||
/**
|
||||
* Represents a Shard spawned by the ShardingManager.
|
||||
* A self-contained shard spawned by the {@link ShardingManager}.
|
||||
* @extends EventEmitter
|
||||
*/
|
||||
class Shard extends EventEmitter {
|
||||
/**
|
||||
|
|
@ -171,7 +172,7 @@ class Shard extends EventEmitter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Evaluates a script on the shard, in the context of the client.
|
||||
* Evaluates a script on the shard, in the context of the {@link Client}.
|
||||
* @param {string} script JavaScript to run on the shard
|
||||
* @returns {Promise<*>} Result of the script execution
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ const { Events } = require('../util/Constants');
|
|||
const { Error } = require('../errors');
|
||||
|
||||
/**
|
||||
* Helper class for sharded clients spawned as a child process, such as from a ShardingManager.
|
||||
* Helper class for sharded clients spawned as a child process, such as from a {@link ShardingManager}.
|
||||
* Utilises IPC to send and receive data to/from the master process and other shards.
|
||||
*/
|
||||
class ShardClientUtil {
|
||||
/**
|
||||
|
|
@ -78,7 +79,7 @@ class ShardClientUtil {
|
|||
}
|
||||
|
||||
/**
|
||||
* Evaluates a script on all shards, in the context of the Clients.
|
||||
* Evaluates a script on all shards, in the context of the {@link Clients}.
|
||||
* @param {string} script JavaScript to run on each shard
|
||||
* @returns {Promise<Array<*>>} Results of the script execution
|
||||
* @see {@link ShardingManager#broadcastEval}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,12 @@ const { Error, TypeError, RangeError } = require('../errors');
|
|||
const delayFor = require('util').promisify(setTimeout);
|
||||
|
||||
/**
|
||||
* This is a utility class that can be used to help you spawn shards of your client. Each shard is completely separate
|
||||
* from the other. The Shard Manager takes a path to a file and spawns it under the specified amount of shards safely.
|
||||
* If you do not select an amount of shards, the manager will automatically decide the best amount.
|
||||
* This is a utility class that makes multi-process sharding of a bot an easy and painless experience.
|
||||
* It works by spawning a self-contained {@link ChildProcess} for each individual shard, each containing its own client.
|
||||
* They all have a line of communication with the master process, and there are several useful methods that utilise
|
||||
* it in order to simplify tasks that are normally difficult with multi-process sharding. It can spawn a specific number
|
||||
* of shards or the amount that Discord suggests for the bot, and takes a path to your main bot script to launch for
|
||||
* each one.
|
||||
* @extends {EventEmitter}
|
||||
*/
|
||||
class ShardingManager extends EventEmitter {
|
||||
|
|
@ -148,7 +151,7 @@ class ShardingManager extends EventEmitter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Evaluates a script on all shards, in the context of the Clients.
|
||||
* Evaluates a script on all shards, in the context of the {@link Client}s.
|
||||
* @param {string} script JavaScript to run on each shard
|
||||
* @returns {Promise<Array<*>>} Results of the script execution
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue