diff --git a/src/imap/idle.rs b/src/imap/idle.rs index e397c435e..de5b31fd1 100644 --- a/src/imap/idle.rs +++ b/src/imap/idle.rs @@ -150,7 +150,7 @@ impl Imap { } if self.config.can_idle { // we only fake-idled because network was gone during IDLE, probably - break InterruptInfo::new(false, None); + break InterruptInfo::new(false); } info!(context, "fake_idle is connected"); // we are connected, let's see if fetching messages results @@ -162,7 +162,7 @@ impl Imap { Ok(res) => { info!(context, "fetch_new_messages returned {:?}", res); if res { - break InterruptInfo::new(false, None); + break InterruptInfo::new(false); } } Err(err) => { diff --git a/src/job.rs b/src/job.rs index 509a983d6..9ff41be5b 100644 --- a/src/job.rs +++ b/src/job.rs @@ -1090,18 +1090,14 @@ pub async fn add(context: &Context, job: Job) -> Result<()> { | Action::UpdateRecentQuota | Action::DownloadMsg => { info!(context, "interrupt: imap"); - context - .interrupt_inbox(InterruptInfo::new(false, None)) - .await; + context.interrupt_inbox(InterruptInfo::new(false)).await; } Action::MaybeSendLocations | Action::MaybeSendLocationsEnded | Action::SendMdn | Action::SendMsgToSmtp => { info!(context, "interrupt: smtp"); - context - .interrupt_smtp(InterruptInfo::new(false, None)) - .await; + context.interrupt_smtp(InterruptInfo::new(false)).await; } } } @@ -1136,20 +1132,9 @@ pub(crate) async fn load_next( let query; let params; let t = time(); - let m; let thread_i = thread as i64; - if let Some(msg_id) = info.msg_id { - query = r#" -SELECT id, action, foreign_id, param, added_timestamp, desired_timestamp, tries -FROM jobs -WHERE thread=? AND foreign_id=? -ORDER BY action DESC, added_timestamp -LIMIT 1; -"#; - m = msg_id; - params = paramsv![thread_i, m]; - } else if !info.probe_network { + if !info.probe_network { // processing for first-try and after backoff-timeouts: // process jobs in the order they were added. query = r#" @@ -1269,7 +1254,7 @@ mod tests { let jobs = load_next( &t, Thread::from(Action::DownloadMsg), - &InterruptInfo::new(false, None), + &InterruptInfo::new(false), ) .await?; // The housekeeping job should be loaded as we didn't run housekeeping in the last day: @@ -1279,7 +1264,7 @@ mod tests { let jobs = load_next( &t, Thread::from(Action::DownloadMsg), - &InterruptInfo::new(false, None), + &InterruptInfo::new(false), ) .await?; assert!(jobs.is_some()); @@ -1295,7 +1280,7 @@ mod tests { let jobs = load_next( &t, Thread::from(Action::DownloadMsg), - &InterruptInfo::new(false, None), + &InterruptInfo::new(false), ) .await?; assert!(jobs.is_some()); diff --git a/src/message.rs b/src/message.rs index ab94aa83f..ab394345f 100644 --- a/src/message.rs +++ b/src/message.rs @@ -1230,9 +1230,7 @@ pub async fn delete_msgs(context: &Context, msg_ids: &[MsgId]) -> Result<()> { } // Interrupt Inbox loop to start message deletion. - context - .interrupt_inbox(InterruptInfo::new(false, None)) - .await; + context.interrupt_inbox(InterruptInfo::new(false)).await; Ok(()) } diff --git a/src/scheduler.rs b/src/scheduler.rs index 6d333407d..0d7d67f10 100644 --- a/src/scheduler.rs +++ b/src/scheduler.rs @@ -10,7 +10,6 @@ use crate::context::Context; use crate::dc_tools::maybe_add_time_based_warnings; use crate::imap::Imap; use crate::job::{self, Thread}; -use crate::message::MsgId; use crate::smtp::Smtp; use self::connectivity::ConnectivityStore; @@ -197,7 +196,7 @@ async fn fetch_idle(ctx: &Context, connection: &mut Imap, folder: Config) -> Int if let Err(err) = connection.fetch_move_delete(ctx, &watch_folder).await { connection.trigger_reconnect(ctx).await; warn!(ctx, "{:#}", err); - return InterruptInfo::new(false, None); + return InterruptInfo::new(false); } connection.connectivity.set_connected(ctx).await; @@ -209,7 +208,7 @@ async fn fetch_idle(ctx: &Context, connection: &mut Imap, folder: Config) -> Int Err(err) => { connection.trigger_reconnect(ctx).await; warn!(ctx, "{}", err); - InterruptInfo::new(false, None) + InterruptInfo::new(false) } } } else { @@ -438,10 +437,10 @@ impl Scheduler { return; } - self.interrupt_inbox(InterruptInfo::new(true, None)) - .join(self.interrupt_mvbox(InterruptInfo::new(true, None))) - .join(self.interrupt_sentbox(InterruptInfo::new(true, None))) - .join(self.interrupt_smtp(InterruptInfo::new(true, None))) + self.interrupt_inbox(InterruptInfo::new(true)) + .join(self.interrupt_mvbox(InterruptInfo::new(true))) + .join(self.interrupt_sentbox(InterruptInfo::new(true))) + .join(self.interrupt_smtp(InterruptInfo::new(true))) .await; } @@ -450,10 +449,10 @@ impl Scheduler { return; } - self.interrupt_inbox(InterruptInfo::new(false, None)) - .join(self.interrupt_mvbox(InterruptInfo::new(false, None))) - .join(self.interrupt_sentbox(InterruptInfo::new(false, None))) - .join(self.interrupt_smtp(InterruptInfo::new(false, None))) + self.interrupt_inbox(InterruptInfo::new(false)) + .join(self.interrupt_mvbox(InterruptInfo::new(false))) + .join(self.interrupt_sentbox(InterruptInfo::new(false))) + .join(self.interrupt_smtp(InterruptInfo::new(false))) .await; } @@ -683,14 +682,10 @@ struct ImapConnectionHandlers { #[derive(Default, Debug)] pub struct InterruptInfo { pub probe_network: bool, - pub msg_id: Option, } impl InterruptInfo { - pub fn new(probe_network: bool, msg_id: Option) -> Self { - Self { - probe_network, - msg_id, - } + pub fn new(probe_network: bool) -> Self { + Self { probe_network } } }