smarter sharding™ (#732)

This commit is contained in:
Gus Caplan
2016-09-23 15:43:16 -05:00
committed by Amish Shah
parent fc9d049cc1
commit 063be5cee2
4 changed files with 18 additions and 12 deletions

View File

@@ -27,6 +27,14 @@ class Client extends EventEmitter {
*/
this.options = mergeDefault(Constants.DefaultOptions, options);
if (!this.options.shard_id && process.env.hasOwnProperty('SHARD_ID')) {
this.options.shard_id = process.env.SHARD_ID;
}
if (!this.options.shard_count && process.env.hasOwnProperty('SHARD_COUNT')) {
this.options.shard_count = process.env.SHARD_COUNT;
}
/**
* The REST manager of the client
* @type {RESTManager}