This commit is contained in:
Mateusz Gruszczyński committed 2026-10-06 23:08:43 +02:00
1 parent 5d2aaeabe6
commit 9d6614c1b4
62 files changed
+558 -230

No files matched your search

+1 -1
View File
@@ -47,7 +47,7 @@ pub enum StickyMode {
Cookie,
IpHash,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(default, deny_unknown_fields)]
pub struct Keepalive {
pub enabled: bool,
+18 -4
View File
@@ -61,10 +61,24 @@ impl Pool {
&previous.settings.passive_health,
))
.ok();
if same_origin && same_health && (old.definition.enabled || !member.definition.enabled)
{
// This pool has not been published or cloned into routes yet.
if let Some(member) = Arc::get_mut(member) {
let same_clients = member.backend.client.reusable_with(&old.backend.client)
&& member
.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
&& same_health
&& (old.definition.enabled || !member.definition.enabled)
{
member.state = old.state.clone();
member.token = old.token.clone();
}
+17
View File
@@ -98,6 +98,23 @@ fn upstream_pool_recycle_limits_are_bounded_and_can_be_disabled() {
assert!(settings.validate().is_ok());
}
#[test]
fn compatible_pool_rebuild_reuses_upstream_clients() {
let previous = pool(Algorithm::LeastConnections, StickyMode::Off);
let mut rebuilt = pool(Algorithm::LeastConnections, StickyMode::Off);
let rebuilt_mut = Arc::get_mut(&mut rebuilt).expect("fresh pool must be uniquely owned");
assert!(!Arc::ptr_eq(
&rebuilt_mut.members[0].backend,
&previous.members[0].backend
));
rebuilt_mut.reuse_observations(&previous);
assert!(Arc::ptr_eq(
&rebuilt_mut.members[0].backend,
&previous.members[0].backend
));
}
#[test]
fn retry_policy_rejects_unbounded_or_non_5xx_configuration() {
let mut settings = Settings::default();