Skip to content

Commit 3a4bcd6

Browse files
committedSep 28, 2024··
make imap clients pool more reliable
1 parent 649d3c5 commit 3a4bcd6

File tree

6 files changed

+57
-91
lines changed

6 files changed

+57
-91
lines changed
 

‎Cargo.lock

+34-34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ clap = { version = "4.4", features = ["derive", "wrap_help"] }
3939
clap_complete = "4.4"
4040
clap_mangen = "0.2"
4141
color-eyre = "0.6"
42-
email-lib = { version = "=0.25.0", default-features = false, features = ["pool", "sync", "derive"] }
42+
email-lib = { version = "=0.25.0", default-features = false, features = ["sync", "derive"] }
4343
oauth-lib = { version = "=0.1.1", optional = true }
4444
once_cell = "1.16"
4545
pimalaya-tui = { version = "=0.1.0", default-features = false, features = ["path", "cli", "config", "tracing"] }

‎src/account/command/doctor.rs

+12-11
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ use std::sync::Arc;
77

88
use clap::Parser;
99
use color_eyre::eyre::{bail, Result};
10-
use email::backend::{Backend, BackendBuilder};
10+
use email::backend::BackendBuilder;
1111
#[cfg(feature = "imap")]
12-
use email::imap::{ImapContextBuilder, ImapContextSync};
12+
use email::imap::ImapContextBuilder;
1313
#[cfg(feature = "maildir")]
14-
use email::maildir::{MaildirContextBuilder, MaildirContextSync};
14+
use email::maildir::MaildirContextBuilder;
1515
#[cfg(feature = "notmuch")]
16-
use email::notmuch::{NotmuchContextBuilder, NotmuchContextSync};
16+
use email::notmuch::NotmuchContextBuilder;
1717
use pimalaya_tui::cli::printer::Printer;
1818
use tracing::{info, instrument};
1919

@@ -56,25 +56,26 @@ impl DoctorAccountCommand {
5656
#[cfg(feature = "imap")]
5757
BackendConfig::Imap(imap_config) => {
5858
printer.log("Checking left IMAP integrity…")?;
59-
let ctx = ImapContextBuilder::new(left_config.clone(), Arc::new(imap_config));
59+
let ctx = ImapContextBuilder::new(left_config.clone(), Arc::new(imap_config))
60+
.with_pool_size(1);
6061
BackendBuilder::new(left_config.clone(), ctx)
61-
.check_up::<Backend<ImapContextSync>>()
62+
.check_up()
6263
.await?;
6364
}
6465
#[cfg(feature = "maildir")]
6566
BackendConfig::Maildir(maildir_config) => {
6667
printer.log("Checking left Maildir integrity…")?;
6768
let ctx = MaildirContextBuilder::new(left_config.clone(), Arc::new(maildir_config));
6869
BackendBuilder::new(left_config.clone(), ctx)
69-
.check_up::<Backend<MaildirContextSync>>()
70+
.check_up()
7071
.await?;
7172
}
7273
#[cfg(feature = "notmuch")]
7374
BackendConfig::Notmuch(notmuch_config) => {
7475
printer.log("Checking left Notmuch integrity…")?;
7576
let ctx = NotmuchContextBuilder::new(left_config.clone(), Arc::new(notmuch_config));
7677
BackendBuilder::new(left_config.clone(), ctx)
77-
.check_up::<Backend<NotmuchContextSync>>()
78+
.check_up()
7879
.await?;
7980
}
8081
};
@@ -93,7 +94,7 @@ impl DoctorAccountCommand {
9394
printer.log("Checking right IMAP integrity…")?;
9495
let ctx = ImapContextBuilder::new(right_config.clone(), Arc::new(imap_config));
9596
BackendBuilder::new(right_config.clone(), ctx)
96-
.check_up::<Backend<ImapContextSync>>()
97+
.check_up()
9798
.await?;
9899
}
99100
#[cfg(feature = "maildir")]
@@ -102,7 +103,7 @@ impl DoctorAccountCommand {
102103
let ctx =
103104
MaildirContextBuilder::new(right_config.clone(), Arc::new(maildir_config));
104105
BackendBuilder::new(right_config.clone(), ctx)
105-
.check_up::<Backend<MaildirContextSync>>()
106+
.check_up()
106107
.await?;
107108
}
108109
#[cfg(feature = "notmuch")]
@@ -111,7 +112,7 @@ impl DoctorAccountCommand {
111112
let ctx =
112113
NotmuchContextBuilder::new(right_config.clone(), Arc::new(notmuch_config));
113114
BackendBuilder::new(right_config.clone(), ctx)
114-
.check_up::<Backend<NotmuchContextSync>>()
115+
.check_up()
115116
.await?;
116117
}
117118
};

0 commit comments

Comments
 (0)
Please sign in to comment.