mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
fix(api): sort shards by shard_id
This commit is contained in:
parent
643c494ffb
commit
fd6909cd96
1 changed files with 3 additions and 1 deletions
|
|
@ -14,7 +14,7 @@ struct ClusterStats {
|
|||
}
|
||||
|
||||
pub async fn discord_state(State(ctx): State<ApiContext>) -> Json<Value> {
|
||||
let shard_status = ctx
|
||||
let mut shard_status = ctx
|
||||
.redis
|
||||
.hgetall::<HashMap<String, String>, &str>("pluralkit:shardstatus")
|
||||
.await
|
||||
|
|
@ -23,6 +23,8 @@ pub async fn discord_state(State(ctx): State<ApiContext>) -> Json<Value> {
|
|||
.map(|v| serde_json::from_str(v).expect("could not deserialize shard"))
|
||||
.collect::<Vec<ShardState>>();
|
||||
|
||||
shard_status.sort_by(|a, b| a.shard_id.cmp(&b.shard_id));
|
||||
|
||||
Json(json!({
|
||||
"shards": shard_status,
|
||||
}))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue