make imap clients pool more reliable

This commit is contained in:
Clément DOUIN 2024-09-28 16:00:10 +02:00
parent 2083e106f8
commit 2386d0f517
No known key found for this signature in database
GPG key ID: 353E4A18EE0FAB72
2 changed files with 51 additions and 51 deletions

94
Cargo.lock generated
View file

@ -262,7 +262,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
] ]
[[package]] [[package]]
@ -297,7 +297,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
] ]
[[package]] [[package]]
@ -308,9 +308,9 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.3.0" version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
[[package]] [[package]]
name = "backtrace" name = "backtrace"
@ -433,7 +433,7 @@ checksum = "e0af050e27e5d57aa14975f97fe47a134c46a390f91819f23a625319a7111bfa"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
] ]
[[package]] [[package]]
@ -510,9 +510,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.1.21" version = "1.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" checksum = "9540e661f81799159abee814118cc139a2004b3a3aa3ea37724a1b66530b90e0"
dependencies = [ dependencies = [
"shlex", "shlex",
] ]
@ -620,7 +620,7 @@ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
] ]
[[package]] [[package]]
@ -871,7 +871,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
] ]
[[package]] [[package]]
@ -1145,7 +1145,7 @@ dependencies = [
[[package]] [[package]]
name = "email-lib" name = "email-lib"
version = "0.25.0" version = "0.25.0"
source = "git+https://github.com/pimalaya/core#0302f46f64f0e47b3573b9ae645a7154641bfd1a" source = "git+https://github.com/pimalaya/core#119975060c78b7632d1760a823428bf6ca07bb03"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"chrono", "chrono",
@ -1197,7 +1197,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f24a09fd651027f8764f8a12c12358715cb9bab622ab3125ede3dd6ae047c95" checksum = "0f24a09fd651027f8764f8a12c12358715cb9bab622ab3125ede3dd6ae047c95"
dependencies = [ dependencies = [
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
] ]
[[package]] [[package]]
@ -1227,7 +1227,7 @@ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
] ]
[[package]] [[package]]
@ -1248,7 +1248,7 @@ checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
] ]
[[package]] [[package]]
@ -1366,9 +1366,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
[[package]] [[package]]
name = "flate2" name = "flate2"
version = "1.0.33" version = "1.0.34"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0"
dependencies = [ dependencies = [
"crc32fast", "crc32fast",
"miniz_oxide 0.8.0", "miniz_oxide 0.8.0",
@ -1501,7 +1501,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
] ]
[[package]] [[package]]
@ -2263,7 +2263,7 @@ dependencies = [
[[package]] [[package]]
name = "keyring-lib" name = "keyring-lib"
version = "0.4.3" version = "0.4.3"
source = "git+https://github.com/pimalaya/core#0302f46f64f0e47b3573b9ae645a7154641bfd1a" source = "git+https://github.com/pimalaya/core#119975060c78b7632d1760a823428bf6ca07bb03"
dependencies = [ dependencies = [
"keyring", "keyring",
"log", "log",
@ -2333,7 +2333,7 @@ checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"libc", "libc",
"redox_syscall 0.5.5", "redox_syscall 0.5.6",
] ]
[[package]] [[package]]
@ -2567,9 +2567,9 @@ dependencies = [
[[package]] [[package]]
name = "nanohtml2text" name = "nanohtml2text"
version = "0.1.4" version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "999681fe3c0524336e98ece1c25ee4278607f25cc1e361ad0f9201c8bf56dc2c" checksum = "9d4bdc3645754d2da280343bd8f1eaa9acf56c4ed75b540c98c898b171a3d867"
[[package]] [[package]]
name = "newline-converter" name = "newline-converter"
@ -2698,7 +2698,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
] ]
[[package]] [[package]]
@ -2745,7 +2745,7 @@ dependencies = [
[[package]] [[package]]
name = "oauth-lib" name = "oauth-lib"
version = "0.1.1" version = "0.1.1"
source = "git+https://github.com/pimalaya/core#0302f46f64f0e47b3573b9ae645a7154641bfd1a" source = "git+https://github.com/pimalaya/core#119975060c78b7632d1760a823428bf6ca07bb03"
dependencies = [ dependencies = [
"log", "log",
"oauth2", "oauth2",
@ -2929,7 +2929,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
"redox_syscall 0.5.5", "redox_syscall 0.5.6",
"smallvec", "smallvec",
"windows-targets 0.52.6", "windows-targets 0.52.6",
] ]
@ -3041,7 +3041,7 @@ dependencies = [
[[package]] [[package]]
name = "pimalaya-tui" name = "pimalaya-tui"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pimalaya/tui#fba8c1284dbaaa4433c7cb6b242e68864d8d5b44" source = "git+https://github.com/pimalaya/tui#b40ca9d9e161b91e9efcb762fa05f06e3fe46f63"
dependencies = [ dependencies = [
"clap", "clap",
"color-eyre", "color-eyre",
@ -3209,7 +3209,7 @@ dependencies = [
[[package]] [[package]]
name = "process-lib" name = "process-lib"
version = "0.4.2" version = "0.4.2"
source = "git+https://github.com/pimalaya/core#0302f46f64f0e47b3573b9ae645a7154641bfd1a" source = "git+https://github.com/pimalaya/core#119975060c78b7632d1760a823428bf6ca07bb03"
dependencies = [ dependencies = [
"log", "log",
"serde", "serde",
@ -3293,9 +3293,9 @@ dependencies = [
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.5.5" version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62871f2d65009c0256aed1b9cfeeb8ac272833c404e13d53d400cd0dad7a2ac0" checksum = "355ae415ccd3a04315d3f8246e86d67689ea74d88d915576e1589a351062a13b"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
] ]
@ -3598,9 +3598,9 @@ dependencies = [
[[package]] [[package]]
name = "rustls-pki-types" name = "rustls-pki-types"
version = "1.8.0" version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55"
[[package]] [[package]]
name = "rustls-webpki" name = "rustls-webpki"
@ -3686,7 +3686,7 @@ dependencies = [
[[package]] [[package]]
name = "secret-lib" name = "secret-lib"
version = "0.4.6" version = "0.4.6"
source = "git+https://github.com/pimalaya/core#0302f46f64f0e47b3573b9ae645a7154641bfd1a" source = "git+https://github.com/pimalaya/core#119975060c78b7632d1760a823428bf6ca07bb03"
dependencies = [ dependencies = [
"keyring-lib", "keyring-lib",
"log", "log",
@ -3781,7 +3781,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
] ]
[[package]] [[package]]
@ -3814,14 +3814,14 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
] ]
[[package]] [[package]]
name = "serde_spanned" name = "serde_spanned"
version = "0.6.7" version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
dependencies = [ dependencies = [
"serde", "serde",
] ]
@ -4060,7 +4060,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"rustversion", "rustversion",
"syn 2.0.77", "syn 2.0.79",
] ]
[[package]] [[package]]
@ -4082,9 +4082,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.77" version = "2.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -4177,7 +4177,7 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
] ]
[[package]] [[package]]
@ -4231,7 +4231,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
] ]
[[package]] [[package]]
@ -4310,7 +4310,7 @@ dependencies = [
"serde", "serde",
"serde_spanned", "serde_spanned",
"toml_datetime", "toml_datetime",
"winnow 0.6.19", "winnow 0.6.20",
] ]
[[package]] [[package]]
@ -4338,7 +4338,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
] ]
[[package]] [[package]]
@ -4590,7 +4590,7 @@ dependencies = [
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -4624,7 +4624,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -4865,9 +4865,9 @@ dependencies = [
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.6.19" version = "0.6.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c52ac009d615e79296318c1bcce2d422aaca15ad08515e344feeda07df67a587" checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@ -5020,7 +5020,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
] ]
[[package]] [[package]]
@ -5040,7 +5040,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.77", "syn 2.0.79",
] ]
[[package]] [[package]]

View file

@ -9,7 +9,7 @@ use std::{fmt::Display, ops::Deref, sync::Arc};
use tracing::instrument; use tracing::instrument;
#[cfg(feature = "imap")] #[cfg(feature = "imap")]
use email::imap::{ImapContextBuilder, ImapContextSync}; use email::imap::{ImapContext, ImapContextBuilder};
#[cfg(any(feature = "account-sync", feature = "maildir"))] #[cfg(any(feature = "account-sync", feature = "maildir"))]
use email::maildir::{MaildirContextBuilder, MaildirContextSync}; use email::maildir::{MaildirContextBuilder, MaildirContextSync};
#[cfg(feature = "notmuch")] #[cfg(feature = "notmuch")]
@ -447,7 +447,7 @@ impl email::backend::context::BackendContextBuilder for BackendContextBuilder {
#[derive(BackendContext, Default)] #[derive(BackendContext, Default)]
pub struct BackendContext { pub struct BackendContext {
#[cfg(feature = "imap")] #[cfg(feature = "imap")]
pub imap: Option<ImapContextSync>, pub imap: Option<ImapContext>,
#[cfg(feature = "maildir")] #[cfg(feature = "maildir")]
pub maildir: Option<MaildirContextSync>, pub maildir: Option<MaildirContextSync>,
@ -463,8 +463,8 @@ pub struct BackendContext {
} }
#[cfg(feature = "imap")] #[cfg(feature = "imap")]
impl AsRef<Option<ImapContextSync>> for BackendContext { impl AsRef<Option<ImapContext>> for BackendContext {
fn as_ref(&self) -> &Option<ImapContextSync> { fn as_ref(&self) -> &Option<ImapContext> {
&self.imap &self.imap
} }
} }