Browse Source

melib/imap: don't retry watch conn on non-network error

jmap-eventsource
Manos Pitsidianakis 1 year ago
parent
commit
1408690a9a
Signed by: epilys GPG Key ID: 73627C2F690DF710
  1. 2
      melib/src/backends/imap.rs
  2. 18
      melib/src/backends/imap/watch.rs

2
melib/src/backends/imap.rs

@ -499,6 +499,8 @@ impl MailBackend for ImapType {
let mut main_conn_lck = timeout(uid_store.timeout, main_conn.lock()).await?;
if err.kind.is_network() {
uid_store.is_online.lock().unwrap().1 = Err(err.clone());
} else {
return Err(err);
}
debug!("Watch failure: {}", err.to_string());
match timeout(uid_store.timeout, main_conn_lck.connect())

18
melib/src/backends/imap/watch.rs

@ -408,14 +408,16 @@ pub async fn examine_updates(
}
}
if uid_store.keep_offline_cache {
cache_handle
.insert_envelopes(mailbox_hash, &v)
.chain_err_summary(|| {
format!(
"Could not save envelopes in cache for mailbox {}",
mailbox.imap_path()
)
})?;
if !cache_handle.mailbox_state(mailbox_hash)?.is_none() {
cache_handle
.insert_envelopes(mailbox_hash, &v)
.chain_err_summary(|| {
format!(
"Could not save envelopes in cache for mailbox {}",
mailbox.imap_path()
)
})?;
}
}
for FetchResponse { uid, envelope, .. } in v {

Loadingโ€ฆ
Cancel
Save