Skip to content

Commit

Permalink
use client.getBotGateway, 500ms between tryConnect
Browse files Browse the repository at this point in the history
  • Loading branch information
HcgRandon committed Jun 2, 2022
1 parent ac99a15 commit f83ed50
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/gateway/ShardManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const Base = require("../structures/Base");
const Collection = require("../util/Collection");
const Endpoints = require("../rest/Endpoints");
const Shard = require("./Shard");

class ShardManager extends Collection {
Expand All @@ -20,7 +19,7 @@ class ShardManager extends Collection {
async connect(shard) {
// fetch max_concurrency if needed
if(!this.concurrency) {
const gateway = await this._client.requestHandler.request("GET", Endpoints.GATEWAY_BOT, true);
const gateway = await this._client.getBotGateway();
if(gateway.session_start_limit && gateway.session_start_limit.max_concurrency) {
this.concurrency = gateway.session_start_limit.max_concurrency;
} else {
Expand Down Expand Up @@ -140,7 +139,7 @@ class ShardManager extends Collection {
this.connectTimeout = setTimeout(() => {
this.connectTimeout = null;
this.tryConnect();
}, 1000);
}, 500);
}
}

Expand Down

0 comments on commit f83ed50

Please sign in to comment.