v0.31.2
This commit is contained in:
1 parent
24af7478b8
commit
0facfe6f5c
44 files changed
+898
-321
No files matched your search
@@ -3,7 +3,7 @@ use crate::{config::CompiledBackend, vhost::PoolMember};
|
||||
use anyhow::{ensure, Result};
|
||||
use axum::body::Body;
|
||||
use http::{HeaderMap, HeaderValue, Request};
|
||||
use rand::{distributions::Alphanumeric, Rng};
|
||||
use rand::{distr::Alphanumeric, RngExt};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{json, Value};
|
||||
use sha2::{Digest, Sha256};
|
||||
@@ -218,7 +218,10 @@ impl Default for Settings {
|
||||
impl Settings {
|
||||
/// Resolve active health per member; a disabled monitor never probes.
|
||||
pub fn health_for(&self, member: &PoolMember) -> HealthCheck {
|
||||
let mut health = member.health_check.clone().unwrap_or_else(|| self.health_check.clone());
|
||||
let mut health = member
|
||||
.health_check
|
||||
.clone()
|
||||
.unwrap_or_else(|| self.health_check.clone());
|
||||
if health.host.is_none() && health.mode == HealthMode::Http {
|
||||
health.host = self.health_check.host.clone();
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ impl Pool {
|
||||
state: Arc::new(BackendState::new(settings.health_for(&definition).mode)),
|
||||
definition,
|
||||
backend,
|
||||
token: rand::thread_rng()
|
||||
.sample_iter(&Alphanumeric)
|
||||
token: rand::rng()
|
||||
.sample_iter(Alphanumeric)
|
||||
.take(32)
|
||||
.map(char::from)
|
||||
.collect(),
|
||||
@@ -53,14 +53,16 @@ impl Pool {
|
||||
};
|
||||
let same_origin = serde_json::to_vec(&member.definition.backend()).ok()
|
||||
== serde_json::to_vec(&old.definition.backend()).ok();
|
||||
let same_health =
|
||||
serde_json::to_vec(&(
|
||||
self.settings.health_for(&member.definition),
|
||||
self.settings.passive_for(&member.definition),
|
||||
)).ok() == serde_json::to_vec(&(
|
||||
let same_health = serde_json::to_vec(&(
|
||||
self.settings.health_for(&member.definition),
|
||||
self.settings.passive_for(&member.definition),
|
||||
))
|
||||
.ok()
|
||||
== serde_json::to_vec(&(
|
||||
previous.settings.health_for(&old.definition),
|
||||
previous.settings.passive_for(&old.definition),
|
||||
)).ok();
|
||||
))
|
||||
.ok();
|
||||
let same_clients = member.backend.client.reusable_with(&old.backend.client)
|
||||
&& member
|
||||
.backend
|
||||
|
||||
Reference in new issue
Block a user