fix(client-rust): CLI batch mode reuses one channel per connection; bench backs off on failure (CRS-004, #257)

This commit is contained in:
Joseph Doherty
2026-12-03 09:40:58 -05:00
parent d424e3e46a
commit 9338c6d51b
5 changed files with 116 additions and 5 deletions
+22
View File
@@ -543,6 +543,28 @@ pub(crate) struct ConnectionArgs {
}
impl ConnectionArgs {
/// Identity of the connection for batch-mode client reuse: every field that
/// changes how the channel is dialed, including the API key actually
/// resolved (flag or environment variable). Held in memory only.
pub(crate) fn cache_key(&self) -> String {
let api_key = self
.api_key
.clone()
.or_else(|| env::var(&self.api_key_env).ok())
.unwrap_or_default();
format!(
"{}|{}|{}|{:?}|{:?}|{}|{}|{}",
self.endpoint,
api_key,
!self.tls || self.plaintext,
self.ca_file,
self.server_name_override,
self.require_certificate_validation,
self.connect_timeout_seconds,
self.call_timeout_seconds
)
}
pub(crate) fn options(&self) -> ClientOptions {
let mut options = ClientOptions::new(self.endpoint.clone())
.with_plaintext(!self.tls || self.plaintext)