mirror of
https://github.com/chatmail/core.git
synced 2026-04-18 14:06:29 +03:00
fix: Save msgs to key-contacts migration state and run migration periodically (#6956)
Save: - (old contact id) -> (new contact id) mapping. - The message id starting from which all messages are already migrated. Run the migration from `housekeeping()` for at least 500 ms and for >= 1000 messages per run.
This commit is contained in:
11
src/sql.rs
11
src/sql.rs
@@ -581,6 +581,12 @@ impl Sql {
|
||||
Ok(value)
|
||||
}
|
||||
|
||||
/// Removes the `key`'s value from the cache.
|
||||
pub(crate) async fn uncache_raw_config(&self, key: &str) {
|
||||
let mut lock = self.config_cache.write().await;
|
||||
lock.remove(key);
|
||||
}
|
||||
|
||||
/// Sets configuration for the given key to 32-bit signed integer value.
|
||||
pub async fn set_raw_config_int(&self, key: &str, value: i32) -> Result<()> {
|
||||
self.set_raw_config(key, Some(&format!("{value}"))).await
|
||||
@@ -724,6 +730,11 @@ pub async fn housekeeping(context: &Context) -> Result<()> {
|
||||
.context("Failed to cleanup HTTP cache")
|
||||
.log_err(context)
|
||||
.ok();
|
||||
migrations::msgs_to_key_contacts(context)
|
||||
.await
|
||||
.context("migrations::msgs_to_key_contacts")
|
||||
.log_err(context)
|
||||
.ok();
|
||||
|
||||
if let Err(err) = remove_unused_files(context).await {
|
||||
warn!(
|
||||
|
||||
Reference in New Issue
Block a user