Add internal sharding options

This commit is contained in:
Amish Shah
2017-06-11 11:36:58 +01:00
parent 355b1cca4a
commit b694ab1b80
2 changed files with 7 additions and 0 deletions

View File

@@ -552,6 +552,12 @@ class Client extends EventEmitter {
if (typeof options.restWsBridgeTimeout !== 'number' || isNaN(options.restWsBridgeTimeout)) {
throw new TypeError('The restWsBridgeTimeout option must be a number.');
}
if (typeof options.internalSharding !== 'boolean') {
throw new TypeError('The internalSharding option must be a boolean.');
}
if (options.internalSharding && ('shardCount' in options || 'shardId' in options)) {
throw new TypeError('You cannot specify shardCount/shardId if you are using internal sharding.');
}
if (!(options.disabledEvents instanceof Array)) throw new TypeError('The disabledEvents option must be an Array.');
}
}

View File

@@ -34,6 +34,7 @@ exports.DefaultOptions = {
apiRequestMethod: 'sequential',
shardId: 0,
shardCount: 0,
internalSharding: false,
messageCacheMaxSize: 200,
messageCacheLifetime: 0,
messageSweepInterval: 0,