From 314c3d5e7818ddb7901164ca208dfb1d6eccc4f7 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Sat, 7 Mar 2020 18:57:17 +0300 Subject: [PATCH] add_imap_deletion_jobs: check only for DeleteMsgOnImap jobs Other jobs may have different meaning for foreign_id. Also removed " \" at the end of lines. --- src/job.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/job.rs b/src/job.rs index a84ca30dc..4d07057c2 100644 --- a/src/job.rs +++ b/src/job.rs @@ -946,11 +946,12 @@ fn add_imap_deletion_jobs(context: &Context) -> sql::Result<()> { // Select all expired messages which don't have a // corresponding message deletion job yet. let msg_ids = context.sql.query_map( - "SELECT id FROM msgs \ - WHERE timestamp < ? \ - AND server_uid != 0 \ - AND NOT EXISTS (SELECT 1 FROM jobs WHERE foreign_id = msgs.id)", - params![threshold_timestamp], + "SELECT id FROM msgs + WHERE timestamp < ? + AND server_uid != 0 + AND NOT EXISTS (SELECT 1 FROM jobs WHERE foreign_id = msgs.id + AND action = ?)", + params![threshold_timestamp, Action::DeleteMsgOnImap], |row| row.get::<_, MsgId>(0), |ids| { ids.collect::, _>>()