From 90f05a34cb428b93783d217f211ed17c86e8b13f Mon Sep 17 00:00:00 2001 From: Schuyler Cebulskie Date: Thu, 22 Sep 2016 23:01:37 -0400 Subject: [PATCH] Return the existing promise instead of erroring --- src/sharding/ShardingManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sharding/ShardingManager.js b/src/sharding/ShardingManager.js index e0cb2295c..773a15198 100644 --- a/src/sharding/ShardingManager.js +++ b/src/sharding/ShardingManager.js @@ -97,8 +97,8 @@ class ShardingManager extends EventEmitter { * @returns {Promise} */ fetchGuildCount(timeout = 3000) { - if (this._guildCountPromise) return Promise.reject(new Error('Already fetching guild count.')); if (this.shards.size !== this.totalShards) return Promise.reject(new Error('Still spawning shards.')); + if (this._guildCountPromise) return this._guildCountPromise; this._guildCountPromise = new Promise((resolve, reject) => { this._guildCount = 0;