mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 13:26:28 +03:00
Move removal of chat message tombstones to a separate function
DELETE operation may be slow compared to UPDATE. It is better to do in a separate job.
This commit is contained in:
@@ -2521,15 +2521,19 @@ pub fn delete_device_expired_messages(context: &Context) -> sql::Result<()> {
|
|||||||
WHERE timestamp < ?",
|
WHERE timestamp < ?",
|
||||||
params![threshold_timestamp],
|
params![threshold_timestamp],
|
||||||
)?;
|
)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
// Delete hidden messages that are removed from the server.
|
/// Removes from the database locally deleted messages that also don't
|
||||||
|
/// have a server UID.
|
||||||
|
pub fn prune_tombstones(context: &Context) -> sql::Result<()> {
|
||||||
context.sql.execute(
|
context.sql.execute(
|
||||||
"DELETE FROM msgs \
|
"DELETE FROM msgs \
|
||||||
WHERE (chat_id = ? OR hidden) \
|
WHERE (chat_id = ? OR hidden) \
|
||||||
AND server_uid = 0",
|
AND server_uid = 0",
|
||||||
params![DC_CHAT_ID_TRASH],
|
params![DC_CHAT_ID_TRASH],
|
||||||
)?;
|
)?;
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user