Only send IncomingMsgBunch if there are more than 0 new messages (#3941)

This commit is contained in:
Hocuri
2023-01-10 14:18:40 +01:00
committed by GitHub
parent 01fe88e337
commit 68cd8dbc3e
2 changed files with 5 additions and 2 deletions

View File

@@ -3,6 +3,7 @@
## Unreleased ## Unreleased
### Changes ### Changes
- Only send IncomingMsgBunch if there are more than 0 new messages #3941
### API-Changes ### API-Changes

View File

@@ -828,11 +828,13 @@ impl Imap {
info!(context, "{} mails read from \"{}\".", read_cnt, folder); info!(context, "{} mails read from \"{}\".", read_cnt, folder);
let msg_ids = received_msgs let msg_ids: Vec<MsgId> = received_msgs
.iter() .iter()
.flat_map(|m| m.msg_ids.clone()) .flat_map(|m| m.msg_ids.clone())
.collect(); .collect();
context.emit_event(EventType::IncomingMsgBunch { msg_ids }); if !msg_ids.is_empty() {
context.emit_event(EventType::IncomingMsgBunch { msg_ids });
}
chat::mark_old_messages_as_noticed(context, received_msgs).await?; chat::mark_old_messages_as_noticed(context, received_msgs).await?;