Skip to content

Commit

Permalink
Fix max_concurrency (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brainicism committed Aug 7, 2021
1 parent af9bb94 commit eecbb6d
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 @@ -415,6 +415,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 eecbb6d

Please sign in to comment.