@@ -6,42 +6,44 @@ If your bot's shards are multi-processed, then a good choice is to use the
66[ Gateway Queue] . The Gateway Queue is a lightweight but powerful application
77that you can host to queue shards across all of your processes.
88
9- The Gateway Queue is library and language agnostic: it's an HTTP server that you
9+ The Gateway Queue is library and language agnostic, it's an HTTP server that you
1010call whenever a shard needs to reconnect to the gateway.
1111
1212### How it works
1313
14- When one of your shards disconnects and needs to perform a full reconnect, then
15- it needs to start a new session with the gateway. If you have multiple processes
16- managing shards, then you may not have communication between these processes.
17- The problems start to happen when multiple shards from these processes try to
18- reconnect at the same time: all but 1 will get ratelimited .
14+ When one of your shards disconnects and needs to perform a full reconnect, it
15+ needs to start a new session with the gateway. If you have multiple processes
16+ managing shards, you may not have communication between these processes. The
17+ problems start to happen when multiple shards from these processes try to
18+ reconnect at the same time, all but 1 will get rate-limited .
1919
2020This is because there's a 5 second ratelimit between new sessions. By sending an
2121HTTP request to the Gateway Queue, it will ratelimit the requests and "stall"
2222them, responding with a friendly message once that shard can reconnect:
2323
2424``` json
25- {"message" : " You're free to connect now! :)" }
25+ {
26+ "message" : " You're free to connect now! :)"
27+ }
2628```
2729
2830### Example
2931
30- The API is pretty minimal, probably . It's just an HTTP request:
32+ The API is pretty minimal. It's just an HTTP request:
3133
3234``` rust
3335reqwest :: get (" http://gateway-queue" ). await ? ;
3436```
3537
36- No headers, body, or particular method need to be set. They 're all ignored.
38+ No headers, body, or particular method need to be set, they 're all ignored.
3739The request will get a response once the request has gone through the queue.
3840
3941### Using with large bots
4042
41- If the bot has access to bucketed identify you will have to make slight
43+ If the bot has access to bucketed identify, you will have to make slight
4244configuration changes. Firstly you will need to set the ` DISCORD_TOKEN `
43- environment variable so it is able to fetch the remaining identifies and what
44- the ` max_concurrency ` is. Secondly you will need to set the query parameter
45+ environment variable so that it is able to fetch the remaining identifies and what
46+ the ` max_concurrency ` is. Secondly, you will need to set the query parameter
4547` shard ` to the ID of the identifying shard.
4648
4749``` rust
0 commit comments