mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
Do ephemeral deletion in async task background loop (#3194)
* Do ephemeral deletion in background loop 1. in start_io start ephemeral async task, in stop_io cancel ephemeral async task 2. start ephemeral async task which loops like this: - wait until next time a message deletion is needed or an interrupt occurs (see 3.) - perform delete_expired_messages including sending MSGS_CHANGED events 3. on new messages (incoming or outgoing) with ephemeral timer: - interrupt ephemeral async task * Changelog * Fix and improve test * no return value needed * address @link2xt review comments * slight normalization: have only one place where we wait for interrupt_receiver * simplify sql statement -- and don't exit the ephemeral_task if there is an sql problem but rather wait * Remove now-unused `ephemeral_task` JoinHandle The JoinHandle is now inside the Scheduler. * fix clippy * Revert accidental move of the line * Add log Co-authored-by: holger krekel <holger@merlinux.eu> Co-authored-by: link2xt <link2xt@testrun.org>
This commit is contained in:
@@ -599,10 +599,6 @@ impl Sql {
|
||||
}
|
||||
|
||||
pub async fn housekeeping(context: &Context) -> Result<()> {
|
||||
if let Err(err) = crate::ephemeral::delete_expired_messages(context).await {
|
||||
warn!(context, "Failed to delete expired messages: {}", err);
|
||||
}
|
||||
|
||||
if let Err(err) = remove_unused_files(context).await {
|
||||
warn!(
|
||||
context,
|
||||
|
||||
Reference in New Issue
Block a user