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:
iequidoo
2025-07-06 16:40:16 -03:00
committed by iequidoo
parent a87ee030fc
commit 389649ea8a
5 changed files with 128 additions and 53 deletions

View File

@@ -1041,6 +1041,13 @@ impl Context {
.await?
.to_string(),
);
res.insert(
"first_key_contacts_msg_id",
self.sql
.get_raw_config("first_key_contacts_msg_id")
.await?
.unwrap_or_default(),
);
let elapsed = time_elapsed(&self.creation_time);
res.insert("uptime", duration_to_str(elapsed));