Improve sharding stuff (#608)

* Improve sharding stuff

* Build docs
This commit is contained in:
Schuyler Cebulskie
2016-09-04 17:02:52 -04:00
committed by Amish Shah
parent 7b870d13de
commit 2c6b804fc9
3 changed files with 44 additions and 18 deletions

View File

@@ -5,6 +5,10 @@ const path = require('path');
* Represents a Shard spawned by the ShardingManager.
*/
class Shard {
/**
* @param {ShardingManager} manager The sharding manager
* @param {number} id The ID of this shard
*/
constructor(manager, id) {
/**
* The manager of the spawned shard
@@ -12,13 +16,13 @@ class Shard {
*/
this.manager = manager;
/**
* The shard id
* The shard ID
* @type {number}
*/
this.id = id;
/**
* The process of the shard
* @type {process}
* @type {ChildProcess}
*/
this.process = childProcess.fork(path.resolve(this.manager.file), [id, this.manager.shards.size]);
}