fix(client-rust): CLI batch mode reuses one channel per connection; bench backs off on failure (CRS-004, #257)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user