perf(build): gate Matrix channel for faster iteration

This commit is contained in:
Chummy 2026-02-19 21:01:26 +08:00
parent 87dcda638c
commit 05404c6e7a
9 changed files with 135 additions and 60 deletions

View file

@ -272,7 +272,9 @@ impl Channel for DiscordChannel {
}
}
});
write.send(Message::Text(identify.to_string())).await?;
write
.send(Message::Text(identify.to_string().into()))
.await?;
tracing::info!("Discord: connected and identified");
@ -301,7 +303,7 @@ impl Channel for DiscordChannel {
_ = hb_rx.recv() => {
let d = if sequence >= 0 { json!(sequence) } else { json!(null) };
let hb = json!({"op": 1, "d": d});
if write.send(Message::Text(hb.to_string())).await.is_err() {
if write.send(Message::Text(hb.to_string().into())).await.is_err() {
break;
}
}
@ -312,7 +314,7 @@ impl Channel for DiscordChannel {
_ => continue,
};
let event: serde_json::Value = match serde_json::from_str(&msg) {
let event: serde_json::Value = match serde_json::from_str(msg.as_ref()) {
Ok(e) => e,
Err(_) => continue,
};
@ -329,7 +331,7 @@ impl Channel for DiscordChannel {
1 => {
let d = if sequence >= 0 { json!(sequence) } else { json!(null) };
let hb = json!({"op": 1, "d": d});
if write.send(Message::Text(hb.to_string())).await.is_err() {
if write.send(Message::Text(hb.to_string().into())).await.is_err() {
break;
}
continue;