mirror of
https://github.com/chatmail/core.git
synced 2026-04-25 01:16: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:
@@ -15,6 +15,7 @@ use tokio_util::task::TaskTracker;
|
||||
|
||||
use self::connectivity::ConnectivityStore;
|
||||
use crate::config::{self, Config};
|
||||
use crate::constants;
|
||||
use crate::contact::{ContactId, RecentlySeenLoop};
|
||||
use crate::context::Context;
|
||||
use crate::download::{DownloadState, download_msg};
|
||||
@@ -497,7 +498,8 @@ async fn inbox_fetch_idle(ctx: &Context, imap: &mut Imap, mut session: Session)
|
||||
|
||||
match ctx.get_config_i64(Config::LastHousekeeping).await {
|
||||
Ok(last_housekeeping_time) => {
|
||||
let next_housekeeping_time = last_housekeeping_time.saturating_add(60 * 60 * 24);
|
||||
let next_housekeeping_time =
|
||||
last_housekeeping_time.saturating_add(constants::HOUSEKEEPING_PERIOD);
|
||||
if next_housekeeping_time <= time() {
|
||||
sql::housekeeping(ctx).await.log_err(ctx).ok();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user