Skip to content

Commit

Permalink
make imap clients pool more reliable
Browse files Browse the repository at this point in the history
  • Loading branch information
soywod committed Sep 28, 2024
1 parent 649d3c5 commit 3a4bcd6
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 91 deletions.
68 changes: 34 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ clap = { version = "4.4", features = ["derive", "wrap_help"] }
clap_complete = "4.4"
clap_mangen = "0.2"
color-eyre = "0.6"
email-lib = { version = "=0.25.0", default-features = false, features = ["pool", "sync", "derive"] }
email-lib = { version = "=0.25.0", default-features = false, features = ["sync", "derive"] }
oauth-lib = { version = "=0.1.1", optional = true }
once_cell = "1.16"
pimalaya-tui = { version = "=0.1.0", default-features = false, features = ["path", "cli", "config", "tracing"] }
Expand Down
23 changes: 12 additions & 11 deletions src/account/command/doctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ use std::sync::Arc;

use clap::Parser;
use color_eyre::eyre::{bail, Result};
use email::backend::{Backend, BackendBuilder};
use email::backend::BackendBuilder;
#[cfg(feature = "imap")]
use email::imap::{ImapContextBuilder, ImapContextSync};
use email::imap::ImapContextBuilder;
#[cfg(feature = "maildir")]
use email::maildir::{MaildirContextBuilder, MaildirContextSync};
use email::maildir::MaildirContextBuilder;
#[cfg(feature = "notmuch")]
use email::notmuch::{NotmuchContextBuilder, NotmuchContextSync};
use email::notmuch::NotmuchContextBuilder;
use pimalaya_tui::cli::printer::Printer;
use tracing::{info, instrument};

Expand Down Expand Up @@ -56,25 +56,26 @@ impl DoctorAccountCommand {
#[cfg(feature = "imap")]
BackendConfig::Imap(imap_config) => {
printer.log("Checking left IMAP integrity…")?;
let ctx = ImapContextBuilder::new(left_config.clone(), Arc::new(imap_config));
let ctx = ImapContextBuilder::new(left_config.clone(), Arc::new(imap_config))
.with_pool_size(1);
BackendBuilder::new(left_config.clone(), ctx)
.check_up::<Backend<ImapContextSync>>()
.check_up()
.await?;
}
#[cfg(feature = "maildir")]
BackendConfig::Maildir(maildir_config) => {
printer.log("Checking left Maildir integrity…")?;
let ctx = MaildirContextBuilder::new(left_config.clone(), Arc::new(maildir_config));
BackendBuilder::new(left_config.clone(), ctx)
.check_up::<Backend<MaildirContextSync>>()
.check_up()
.await?;
}
#[cfg(feature = "notmuch")]
BackendConfig::Notmuch(notmuch_config) => {
printer.log("Checking left Notmuch integrity…")?;
let ctx = NotmuchContextBuilder::new(left_config.clone(), Arc::new(notmuch_config));
BackendBuilder::new(left_config.clone(), ctx)
.check_up::<Backend<NotmuchContextSync>>()
.check_up()
.await?;
}
};
Expand All @@ -93,7 +94,7 @@ impl DoctorAccountCommand {
printer.log("Checking right IMAP integrity…")?;
let ctx = ImapContextBuilder::new(right_config.clone(), Arc::new(imap_config));
BackendBuilder::new(right_config.clone(), ctx)
.check_up::<Backend<ImapContextSync>>()
.check_up()
.await?;
}
#[cfg(feature = "maildir")]
Expand All @@ -102,7 +103,7 @@ impl DoctorAccountCommand {
let ctx =
MaildirContextBuilder::new(right_config.clone(), Arc::new(maildir_config));
BackendBuilder::new(right_config.clone(), ctx)
.check_up::<Backend<MaildirContextSync>>()
.check_up()
.await?;
}
#[cfg(feature = "notmuch")]
Expand All @@ -111,7 +112,7 @@ impl DoctorAccountCommand {
let ctx =
NotmuchContextBuilder::new(right_config.clone(), Arc::new(notmuch_config));
BackendBuilder::new(right_config.clone(), ctx)
.check_up::<Backend<NotmuchContextSync>>()
.check_up()
.await?;
}
};
Expand Down
Loading

0 comments on commit 3a4bcd6

Please sign in to comment.