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

pull/144/head
Manos Pitsidianakis 4 years ago
parent 76814cea20
commit 1408690a9a
No known key found for this signature in database
GPG Key ID: 73627C2F690DF710

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

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

Loading…
Cancel
Save