mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 03:23:29 +01:00
fix(ShardingManager): fix respawnAll not passing delay correctly (#7084)
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user