From 22e8e3e86ce922e76262f33ceeec2388334a5264 Mon Sep 17 00:00:00 2001 From: Amaury <1293565+amaury1729@users.noreply.github.com> Date: Tue, 12 Dec 2023 19:01:01 +0100 Subject: [PATCH] fix!(core): Bump timeout to 45s, set retries to 1 (#1406) 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. --- core/src/rules.json | 8 ++++++-- core/src/util/input_output.rs | 11 ++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/core/src/rules.json b/core/src/rules.json index bc7e9110c..89150b6d1 100644 --- a/core/src/rules.json +++ b/core/src/rules.json @@ -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.": { @@ -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." } } } diff --git a/core/src/util/input_output.rs b/core/src/util/input_output.rs index a6c2c9bba..c00c1df34 100644 --- a/core/src/util/input_output.rs +++ b/core/src/util/input_output.rs @@ -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, /// Select how to verify Yahoo emails. /// @@ -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, - /// 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. /// @@ -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")] @@ -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![], } }