mirror of
https://github.com/chatmail/core.git
synced 2026-05-06 06: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:
@@ -9,7 +9,6 @@ use crate::constants::{
|
||||
};
|
||||
use crate::contact::{Contact, ContactId};
|
||||
use crate::context::Context;
|
||||
use crate::ephemeral::delete_expired_messages;
|
||||
use crate::message::{Message, MessageState, MsgId};
|
||||
use crate::stock_str;
|
||||
use crate::summary::Summary;
|
||||
@@ -91,12 +90,6 @@ impl Chatlist {
|
||||
let flag_no_specials = 0 != listflags & DC_GCL_NO_SPECIALS;
|
||||
let flag_add_alldone_hint = 0 != listflags & DC_GCL_ADD_ALLDONE_HINT;
|
||||
|
||||
// Note that we do not emit DC_EVENT_MSGS_MODIFIED here even if some
|
||||
// messages get deleted to avoid reloading the same chatlist.
|
||||
if let Err(err) = delete_expired_messages(context).await {
|
||||
warn!(context, "Failed to hide expired messages: {}", err);
|
||||
}
|
||||
|
||||
let mut add_archived_link_item = false;
|
||||
|
||||
let process_row = |row: &rusqlite::Row| {
|
||||
|
||||
Reference in New Issue
Block a user