Skip to content

Files

Failed to load latest commit information.

Latest commit

 Cannot retrieve latest commit at this time.

History

History
 
 

twilight-gateway-queue

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

twilight-gateway-queue

codecov badge discord badge github badge license badge rust badge

Rate limiting functionality for gateway IDENTIFY commands.

Discord allows bot's shards to send a limited amount of IDENTIFY commands every 5 seconds, with a daily limit from 1000 to 2000 commands, and invalidates all shard sessions upon exceeding it. Each identify interval may be filled by shards' IDs modulo max_concurrency and such a set of shards is called a bucket. See Discord Docs/Sharding.

To coordinate this, a [Queue] should process each identify request and shards should wait for its signal to proceed before continuing and otherwise retry. The provided [InMemoryQueue] never fails or cancels requests and is therefore a good starting point for custom implementations. It can also be composed to support multiple processes; see gateway-queue-http and gateway-queue for a HTTP client and server implementation, respectively.