Skip to content

Commit

Permalink
feat(ShardingManager): Allow b-Eval/fetchClientValues on a specific s…
Browse files Browse the repository at this point in the history
…hard when not all are ready (#5222)

Co-authored-by: BennyDiscord <46286597+BennyDiscord@users.noreply.github.com>
  • Loading branch information
Skye-31 and Skye-31 authored Jan 24, 2021
1 parent a33eed7 commit 001676c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sharding/ShardingManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,14 @@ class ShardingManager extends EventEmitter {
*/
_performOnShards(method, args, shard) {
if (this.shards.size === 0) return Promise.reject(new Error('SHARDING_NO_SHARDS'));
if (this.shards.size !== this.shardList.length) return Promise.reject(new Error('SHARDING_IN_PROCESS'));

if (typeof shard === 'number') {
if (this.shards.has(shard)) return this.shards.get(shard)[method](...args);
return Promise.reject(new Error('SHARDING_SHARD_NOT_FOUND', shard));
}

if (this.shards.size !== this.shardList.length) return Promise.reject(new Error('SHARDING_IN_PROCESS'));

const promises = [];
for (const sh of this.shards.values()) promises.push(sh[method](...args));
return Promise.all(promises);
Expand Down

0 comments on commit 001676c

Please sign in to comment.