0.34.6_repo_cleanup

This commit is contained in:
Mateusz Gruszczyński committed 2026-10-22 09:31:15 +02:00
1 parent ce1a90397c
commit 133d2f0f91
273 files changed
+5969 -6926

No files matched your search

+18 -29
View File
@@ -72,13 +72,8 @@ impl Pool {
.backend
.websocket_client
.reusable_with(&old.backend.websocket_client);
// This pool has not been published or cloned into routes yet.
if let Some(member) = Arc::get_mut(member) {
if same_clients {
// Preserve the live Hyper pools and, with them, generation
// age/request/rotation state across unrelated snapshot
// rebuilds. Changed origins, address policy, keepalive or
// connect timeout still receive newly compiled clients.
member.backend = old.backend.clone();
}
if same_origin
@@ -215,9 +210,6 @@ impl Pool {
tls: bool,
excluded: &[String],
) -> Option<Selection> {
// Most deployments have one healthy backend. For non-cookie modes it
// needs neither candidate Vecs, weight scoring nor the shared scheduler
// mutex. Still use the same atomic capacity lease and health gate.
if self.members.len() == 1 && !self.cookie_affinity() {
let member = &self.members[0];
if !member.definition.pool_eligible
@@ -247,8 +239,6 @@ impl Pool {
} else {
None
};
// Drain stops new assignments while existing cookie-affine clients may
// finish their session. Disabled/unhealthy members never receive traffic.
let matched = existing.and_then(|token| {
self.members.iter().find(|m| {
m.token == token
@@ -269,8 +259,6 @@ impl Pool {
if self.settings.algorithm == Algorithm::RoundRobin
&& self.settings.sticky.mode != StickyMode::IpHash
{
// Smooth weighted round-robin keeps its historical state and
// global ordering. Only that algorithm takes the mutex.
let mut scheduling = lock(&self.scheduling);
let mut chosen = members[0];
let mut best = f64::NEG_INFINITY;
@@ -279,13 +267,14 @@ impl Pool {
let weight = member
.state
.weight(member.definition.weight, self.settings.slow_start_seconds);
let current = if let Some(current) =
scheduling.get_mut(member.definition.id.as_str())
{
current
} else {
scheduling.entry(member.definition.id.clone()).or_insert(0.0)
};
let current =
if let Some(current) = scheduling.get_mut(member.definition.id.as_str()) {
current
} else {
scheduling
.entry(member.definition.id.clone())
.or_insert(0.0)
};
*current += weight;
total += weight;
if *current > best {
@@ -305,8 +294,6 @@ impl Pool {
} else {
self.settings.algorithm
};
// Canonicalize the address once, not for every candidate. The
// SHA-256 input and rendezvous scoring remain bit-for-bit equal.
let hash_ip = (algorithm == Algorithm::IpHash)
.then(|| crate::vhost::canonical_ip(peer).to_string());
for offset in 0..members.len() {
@@ -330,16 +317,18 @@ impl Pool {
-unit.max(f64::MIN_POSITIVE).ln() / member.definition.weight as f64
}
_ => {
let weight = member.state.weight(
member.definition.weight,
self.settings.slow_start_seconds,
);
let weight = member
.state
.weight(member.definition.weight, self.settings.slow_start_seconds);
match algorithm {
Algorithm::LeastTraffic =>
(member.state.traffic_rate() + (active + 1.0) * 1024.0) / weight,
Algorithm::Adaptive =>
Algorithm::LeastTraffic => {
(member.state.traffic_rate() + (active + 1.0) * 1024.0) / weight
}
Algorithm::Adaptive => {
((active + 1.0) * member.state.latency()
+ member.state.traffic_rate() / 16_384.0) / weight,
+ member.state.traffic_rate() / 16_384.0)
/ weight
}
_ => (active + 1.0) / weight,
}
}