
https://github.com/twilight-rs/gateway-queue/actions
If your bot's shards are multi-processed, then a good choice is to use the Gateway Queue. The Gateway Queue is a lightweight but powerful application that you can host to queue shards across all of your processes.
The Gateway Queue is library and language agnostic: it's an HTTP server that you call whenever a shard needs to reconnect to the gateway.
When one of your shards disconnects and needs to perform a full reconnect, then it needs to start a new session with the gateway. If you have multiple processes managing shards, then you may not have communication between these processes. The problems start to happen when multiple shards from these processes try to reconnect at the same time: all but 1 (with the exception of max_concurrency > 1 enabled bots, more on that below) will get ratelimited.
This is because there's a 5 second ratelimit between new sessions. By sending an HTTP request to the Gateway Queue, it will ratelimit the requests and "stall" them, responding with a friendly message once that shard can reconnect:
json{"message": "You're free to connect now! :)"}
The API is pretty minimal, probably. It's just an HTTP request:
rustreqwest::get("http://gateway-queue").await?;
No headers, body, or particular method need to be set. They're all ignored. The request will get a response once the request has gone through the queue.
sh$ docker run -itd -e HOST=0.0.0.0 -e PORT=5000 twilightrs/gateway-queue
HOST and PORT are the two main environment variables. Optionally, you can add DISCORD_TOKEN and set it to your bot's token to enable automatic support for max_concurrency API features.

探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务