From fba27ff88429d1fb43f38d362576481b425eb473 Mon Sep 17 00:00:00 2001 From: iequidoo Date: Wed, 7 Feb 2024 01:30:51 -0300 Subject: [PATCH] fix: Guarantee immediate message deletion if delete_server_after == 0 (#5201) --- src/ephemeral.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ephemeral.rs b/src/ephemeral.rs index 694c1d41c7..3e8ec39add 100644 --- a/src/ephemeral.rs +++ b/src/ephemeral.rs @@ -590,7 +590,11 @@ pub(crate) async fn delete_expired_imap_messages(context: &Context) -> Result<() match context.get_config_delete_server_after().await? { None => (0, 0), Some(delete_server_after) => ( - now - delete_server_after, + match delete_server_after { + // Guarantee immediate deletion. + 0 => i64::MAX, + _ => now - delete_server_after, + }, now - max(delete_server_after, MIN_DELETE_SERVER_AFTER), ), };