fix(ShardingManager): do not spawn the last shard early

An off-by-one error resulted in the last shard getting the delay of the second last one.
Closes #3181
This commit is contained in:
SpaceEEC
2019-04-05 14:46:25 +02:00
parent 5e9bd786d1
commit bfab203934

View File

@@ -194,7 +194,7 @@ class ShardingManager extends EventEmitter {
const promises = [];
const shard = this.createShard(shardID);
promises.push(shard.spawn(waitForReady));
if (delay > 0 && this.shards.size !== this.shardList.length - 1) promises.push(Util.delayFor(delay));
if (delay > 0 && this.shards.size !== this.shardList.length) promises.push(Util.delayFor(delay));
await Promise.all(promises); // eslint-disable-line no-await-in-loop
}