Skip to content

Commit

Permalink
fix: chat::save_msgs: Interrupt inbox loop to send a sync message
Browse files Browse the repository at this point in the history
Also fix the `send_sync_msg()` documentation: now it's called from the inbox loop, not SMTP (because
`IMAP APPEND` is used to upload sync messages).
  • Loading branch information
iequidoo committed Feb 26, 2025
1 parent c58f610 commit a9fbdaf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4374,7 +4374,7 @@ pub async fn save_msgs(context: &Context, msg_ids: &[MsgId]) -> Result<()> {
})
.await?;
}
context.send_sync_msg().await?;
context.scheduler.interrupt_inbox().await;
Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl Context {
///
/// Mustn't be called from multiple tasks in parallel to avoid sending the same sync items twice
/// because sync items are removed from the db only after successful sending. We guarantee this
/// by calling `send_sync_msg()` only from the SMTP loop.
/// by calling `send_sync_msg()` only from the inbox loop.
pub async fn send_sync_msg(&self) -> Result<Option<MsgId>> {
if let Some((json, ids)) = self.build_sync_json().await? {
let chat_id =
Expand Down

0 comments on commit a9fbdaf

Please sign in to comment.