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:
16
src/Discord.Net.Rest/API/Common/SessionStartLimit.cs
Normal file
16
src/Discord.Net.Rest/API/Common/SessionStartLimit.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rest
|
||||
{
|
||||
internal class SessionStartLimit
|
||||
{
|
||||
[JsonProperty("total")]
|
||||
public int Total { get; set; }
|
||||
[JsonProperty("remaining")]
|
||||
public int Remaining { get; set; }
|
||||
[JsonProperty("reset_after")]
|
||||
public int ResetAfter { get; set; }
|
||||
[JsonProperty("max_concurrency")]
|
||||
public int MaxConcurrency { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma warning disable CS1591
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API.Rest
|
||||
@@ -9,5 +9,7 @@ namespace Discord.API.Rest
|
||||
public string Url { get; set; }
|
||||
[JsonProperty("shards")]
|
||||
public int Shards { get; set; }
|
||||
[JsonProperty("session_start_limit")]
|
||||
public SessionStartLimit SessionStartLimit { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user