Skip to content

Commit

Permalink
Fix max_concurrency (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brainicism authored and taahamahdi committed Aug 19, 2021
1 parent 4592168 commit a59e84c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ class Client extends EventEmitter {
async connect() {
try {
const data = await (this.options.maxShards === "auto" ? this.getBotGateway() : this.getGateway());
this.shards.maxConcurrency = this.options.maxShards === "auto" ? data.session_start_limit.max_concurrency : 1;
this._client.options.useMaxConcurrency = this._client.options.useMaxConcurrency && this.shards.maxConcurrency !== 1;
if(!data.url || (this.options.maxShards === "auto" && !data.shards)) {
throw new Error("Invalid response from gateway REST call");
}
Expand Down

0 comments on commit a59e84c

Please sign in to comment.