Skip to content

Commit

Permalink
fix!(core): Bump timeout to 45s, set retries to 1 (#1406)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Vercel functions (used by https://app.reacher.email) usually timeout with a 504 error within less than 60s. So we should absolutely make a verification in less time than that.

After some testing, Reacher performs better with this setting:
- each SMTP connection times out after 45s, but we don't retry
over this previous setting
- each SMTP connection times out after ~20s, but we do retry once (to avoid greylisting in some rare cases)

Changing the default behaviour in this PR.
  • Loading branch information
amaury1093 authored Dec 12, 2023
1 parent db90cfa commit 22e8e3e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
8 changes: 6 additions & 2 deletions core/src/rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
"yahoo.fr": { "rules": ["SkipCatchAll"] }
},
"by_mx": {
"filter30.antispamcloud.com.": { "rules": ["HoneyPot"] }
"filter30.antispamcloud.com.": { "rules": ["HoneyPot"] },
"futuresinitiative.org.": { "rules": ["SmtpTimeout45s"] },
"mail.digimarcon.com.": { "rules": ["SmtpTimeout45s"] },
"mail.glasasoftball.org.": { "rules": ["SmtpTimeout45s"] },
"nosotrosorg.com.": { "rules": ["SmtpTimeout45s"] }
},
"by_mx_suffix": {
".antispamcloud.com.": {
Expand All @@ -19,7 +23,7 @@
"rules": {
"SkipCatchAll": { "_comment": "Don't perform catch-all check" },
"SmtpTimeout45s": {
"_comment": "Set SMTP connection timeout to at least 45s. If the user request set an even higher timeout, take that one. Please note that this timeout is **per SMTP connection**. By default, we try 2 connections per email: if the 1st one failed, then we connect again to avoid potential greylisting, in which case the whole verification takes 1min30s."
"_comment": "Set SMTP connection timeout to at least 45s. If the user request set an even higher timeout, take that one. Please note that this timeout is **per SMTP connection**. We might try 2 connections per email: if the 1st one failed, then we connect again to avoid potential greylisting, in which case the whole verification takes 1min30s."
}
}
}
11 changes: 6 additions & 5 deletions core/src/util/input_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ pub struct CheckEmailInput {
/// Add timeout for the SMTP verification step. Set to None if you don't
/// want to use a timeout.
///
/// Defaults to 12s (more than 10s, but when run twice less than 30s).
/// Defaults to 30s.
pub smtp_timeout: Option<Duration>,
/// Select how to verify Yahoo emails.
///
Expand All @@ -203,9 +203,10 @@ pub struct CheckEmailInput {
/// Check if a the email address is present in HaveIBeenPwned API.
// If the api_key is filled, HaveIBeenPwned API is checked
pub haveibeenpwned_api_key: Option<String>,
/// Number of retries of SMTP connections to do.
/// Number of retries of SMTP connections to do. Setting to 2 might bypass
/// greylisting on some servers, but takes more time.
///
/// Defaults to 2 to avoid greylisting.
/// Defaults to 1.
pub retries: usize,
/// How to apply TLS to a SMTP client connection.
///
Expand Down Expand Up @@ -241,7 +242,7 @@ impl Default for CheckEmailInput {
proxy: None,
smtp_port: 25,
smtp_security: SmtpSecurity::default(),
smtp_timeout: Some(Duration::from_secs(12)),
smtp_timeout: Some(Duration::from_secs(45)),
#[cfg(not(feature = "headless"))]
yahoo_verif_method: YahooVerifMethod::Api,
#[cfg(feature = "headless")]
Expand All @@ -253,7 +254,7 @@ impl Default for CheckEmailInput {
hotmail_verif_method: HotmailVerifMethod::Headless,
check_gravatar: false,
haveibeenpwned_api_key: None,
retries: 2,
retries: 1,
skipped_domains: vec![],
}
}
Expand Down

0 comments on commit 22e8e3e

Please sign in to comment.