mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(WebSocketManager): always cache result of fetchGatewayInformation (#9611)
* fix(WebSocketManager): always cache result of fetchGatewayInformation * fix: add comment
This commit is contained in:
@@ -234,7 +234,8 @@ export class WebSocketManager extends AsyncEventEmitter<ManagerShardEventsMap> {
|
||||
|
||||
const data = (await this.options.rest.get(Routes.gatewayBot())) as RESTGetAPIGatewayBotResult;
|
||||
|
||||
this.gatewayInformation = { data, expiresAt: Date.now() + data.session_start_limit.reset_after };
|
||||
// For single sharded bots session_start_limit.reset_after will be 0, use 5 seconds as a minimum expiration time
|
||||
this.gatewayInformation = { data, expiresAt: Date.now() + (data.session_start_limit.reset_after || 5_000) };
|
||||
return this.gatewayInformation.data;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user