feature: Implement gateway ratelimit (#1537)
* Implement gateway ratelimit * Remove unused code * Share WebSocketRequestQueue between clients * Add global limit and a way to change gateway limits * Refactoring variable to fit lib standards * Update xml docs * Update xml docs * Move warning to remarks * Remove specific RequestQueue for WebSocket and other changes The only account limit is for identify that is dealt in a different way (exclusive semaphore), so websocket queues can be shared with REST and don't need to be shared between clients anymore. Also added the ratelimit for presence updates. * Add summary to IdentifySemaphoreName * Fix spacing * Add max_concurrency and other fixes - Add session_start_limit to GetBotGatewayResponse - Add GetBotGatewayAsync to IDiscordClient - Add master/slave semaphores to enable concurrency - Not store semaphore name as static - Clone GatewayLimits when cloning the Config * Add missing RequestQueue parameter and wrong nullable * Add RequeueQueue paramater to Webhook * Better xml documentation * Remove GatewayLimits class and other changes - Remove GatewayLimits - Transfer a few properties to DiscordSocketConfig - Remove unnecessary usings * Remove unnecessary using and wording * Remove more unnecessary usings * Change named Semaphores to SemaphoreSlim * Remove unused using * Update branch * Fix merge conflicts and update to new ratelimit * Fixing merge, ignore limit for heartbeat, and dispose * Missed one place and better xml docs. * Wait identify before opening the connection * Only request identify ticket when needed * Move identify control to sharded client * Better description for IdentifyMaxConcurrency * Add lock to InvalidSession
This commit is contained in:
@@ -126,6 +126,14 @@ namespace Discord.WebSocket
|
||||
public bool GuildSubscriptions { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum identify concurrency.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This information is provided by Discord.
|
||||
/// It is only used when using a <see cref="DiscordShardedClient"/> and auto-sharding is disabled.
|
||||
/// </remarks>
|
||||
public int IdentifyMaxConcurrency { get; set; } = 1;
|
||||
|
||||
/// Gets or sets the maximum wait time in milliseconds between GUILD_AVAILABLE events before firing READY.
|
||||
///
|
||||
/// If zero, READY will fire as soon as it is received and all guilds will be unavailable.
|
||||
|
||||
Reference in New Issue
Block a user