huskies: merge 1054
This commit is contained in:
@@ -33,6 +33,20 @@ pub(in crate::chat::transport::matrix::bot) async fn on_room_message(
|
||||
ev.sender,
|
||||
);
|
||||
|
||||
// Deduplicate: the Matrix sync loop replays events on reconnect. Insert the
|
||||
// event_id before any side-effecting work; return early if already handled.
|
||||
{
|
||||
let mut seen = ctx.handled_incoming_event_ids.lock().await;
|
||||
if !seen.insert(ev.event_id.clone()) {
|
||||
slog!(
|
||||
"[matrix-bot] Dropping duplicate event {} from {}",
|
||||
ev.event_id,
|
||||
ev.sender
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Only handle messages from rooms we are configured to listen in.
|
||||
if !ctx.target_room_ids.iter().any(|r| r == &incoming_room_id) {
|
||||
slog!("[matrix-bot] Ignoring message from unconfigured room {incoming_room_id}");
|
||||
|
||||
Reference in New Issue
Block a user