fix(ShardingManager): fix respawnAll not passing delay correctly (#7084)

This commit is contained in:
Antonio Román
2021-12-10 10:07:35 +01:00
committed by GitHub
parent 6e57b65e99
commit de61fe4854

View File

@@ -301,12 +301,12 @@ class ShardingManager extends EventEmitter {
/** /**
* Kills all running shards and respawns them. * Kills all running shards and respawns them.
* @param {MultipleShardRespawnOptions} [options] Options for respawning shards * @param {MultipleShardRespawnOptions} [options] Options for respawning shards
* @returns {Promise<Collection<string, Shard>>} * @returns {Promise<Collection<number, Shard>>}
*/ */
async respawnAll({ shardDelay = 5_000, respawnDelay = 500, timeout = 30_000 } = {}) { async respawnAll({ shardDelay = 5_000, respawnDelay = 500, timeout = 30_000 } = {}) {
let s = 0; let s = 0;
for (const shard of this.shards.values()) { for (const shard of this.shards.values()) {
const promises = [shard.respawn({ respawnDelay, timeout })]; const promises = [shard.respawn({ delay: respawnDelay, timeout })];
if (++s < this.shards.size && shardDelay > 0) promises.push(sleep(shardDelay)); if (++s < this.shards.size && shardDelay > 0) promises.push(sleep(shardDelay));
await Promise.all(promises); // eslint-disable-line no-await-in-loop await Promise.all(promises); // eslint-disable-line no-await-in-loop
} }