Skip to content

Commit b42f558

Browse files
committed
performance: skip a costly call to chat.why_cant_send_ex()
1 parent 1eef44e commit b42f558

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/chat.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2691,9 +2691,7 @@ async fn prepare_send_msg(
26912691
CantSendReason::InBroadcast => {
26922692
matches!(
26932693
msg.param.get_cmd(),
2694-
SystemMessage::MemberRemovedFromGroup
2695-
| SystemMessage::SecurejoinMessage
2696-
| SystemMessage::WebxdcStatusUpdate
2694+
SystemMessage::MemberRemovedFromGroup | SystemMessage::SecurejoinMessage
26972695
)
26982696
}
26992697
CantSendReason::MissingKey => msg
@@ -2702,7 +2700,9 @@ async fn prepare_send_msg(
27022700
.unwrap_or_default(),
27032701
_ => false,
27042702
};
2705-
if let Some(reason) = chat.why_cant_send_ex(context, &skip_fn).await? {
2703+
if msg.param.get_cmd() == SystemMessage::WebxdcStatusUpdate {
2704+
// Already checked in `send_webxdc_status_update_struct()`.
2705+
} else if let Some(reason) = chat.why_cant_send_ex(context, &skip_fn).await? {
27062706
bail!("Cannot prepare sending to {chat_id}: {reason}");
27072707
}
27082708

0 commit comments

Comments
 (0)