mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
Mark messages as seen in IMAP loop
MarkseenMsgOnImap job, that was responsible for marking messages as seen on IMAP and sending MDNs, has been removed. Messages waiting to be marked as seen are now stored in a single-column imap_markseen table consisting of foreign keys pointing to corresponding imap table records. Messages are marked as seen in batches in the inbox loop. UIDs are grouped by folders to reduce the number of requests, including folder selection requests. UID grouping logic has been factored out of move_delete_messages into UidGrouper iterator to avoid code duplication. Messages are marked as seen right before fetching from the inbox folder. This ensures that even if new messages arrive into inbox while the connection has another folder selected to mark messages there, all messages are fetched before going IDLE. Ideally marking messages as seen should be done after fetching and moving, as it is a low-priority task, but this requires skipping IDLE if UIDNEXT has advanced since previous time inbox has been selected. This is outside of the scope of this change. MDNs are now queued independently of marking the messages as seen. SendMdn job is created directly rather than after marking the message as seen on IMAP. Previously sending MDNs was done in MarkseenMsgOnImap avoid duplicate MDN sending by setting $MDNSent flag together with \Seen flag and skipping MDN sending if the flag is already set. This is not the case anymore as $MDNSent flag support has been removed in9c077c98cdand duplicate MDN sending in multi-device case is avoided by synchronizing Seen status since833e5f46ccas long as the server supports CONDSTORE extension.
This commit is contained in:
@@ -613,6 +613,17 @@ CREATE INDEX smtp_messageid ON imap(rfc724_mid);
|
||||
sql.execute_migration("DROP TABLE IF EXISTS backup_blobs;", 88)
|
||||
.await?;
|
||||
}
|
||||
if dbversion < 89 {
|
||||
info!(context, "[migration] v89");
|
||||
sql.execute_migration(
|
||||
r#"CREATE TABLE imap_markseen (
|
||||
id INTEGER,
|
||||
FOREIGN KEY(id) REFERENCES imap(id) ON DELETE CASCADE
|
||||
);"#,
|
||||
89,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
||||
Ok((
|
||||
recalc_fingerprints,
|
||||
|
||||
Reference in New Issue
Block a user