diff --git a/crates/kumo-api-types/src/egress_path.rs b/crates/kumo-api-types/src/egress_path.rs index bd2afe15..fc0c5f01 100644 --- a/crates/kumo-api-types/src/egress_path.rs +++ b/crates/kumo-api-types/src/egress_path.rs @@ -98,6 +98,10 @@ pub struct EgressPathConfig { #[serde(default)] pub suspended: bool, + + // TODO: decide if we want to keep this and then document + #[serde(default)] + pub aggressive_connection_opening: bool, } #[cfg(feature = "lua")] @@ -125,6 +129,7 @@ impl Default for EgressPathConfig { smtp_auth_plain_username: None, smtp_auth_plain_password: None, suspended: false, + aggressive_connection_opening: false, } } } diff --git a/crates/kumod/src/ready_queue.rs b/crates/kumod/src/ready_queue.rs index c926abe8..8a6b0ae8 100644 --- a/crates/kumod/src/ready_queue.rs +++ b/crates/kumod/src/ready_queue.rs @@ -628,12 +628,20 @@ impl Dispatcher { } }; - dispatcher.obtain_message().await; - if dispatcher.msg.is_none() { - // We raced with another dispatcher and there is no - // more work to be done; no need to open a new connection. - dispatcher.lease.release().await; - return Ok(()); + // We get better throughput by being more aggressive with establishing + // connections. + if !dispatcher + .path_config + .borrow() + .aggressive_connection_opening + { + dispatcher.obtain_message().await; + if dispatcher.msg.is_none() { + // We raced with another dispatcher and there is no + // more work to be done; no need to open a new connection. + dispatcher.lease.release().await; + return Ok(()); + } } let mut connection_failures = vec![];