aboutsummaryrefslogtreecommitdiff
path: root/src/proxy_config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/proxy_config.rs')
-rw-r--r--src/proxy_config.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/proxy_config.rs b/src/proxy_config.rs
index 2ce462e..ac37229 100644
--- a/src/proxy_config.rs
+++ b/src/proxy_config.rs
@@ -75,10 +75,10 @@ pub struct ProxyEntry {
/// when matching this rule
pub add_headers: Vec<(String, String)>,
- // Counts the number of times this proxy server has been called to
- // This implements a round-robin load balancer if there are multiple
- // entries for the same host and same path prefix.
- pub calls: atomic::AtomicI64,
+ /// Number of calls in progress, used to deprioritize slow back-ends
+ pub calls_in_progress: atomic::AtomicI64,
+ /// Time of last call, used for round-robin selection
+ pub last_call: atomic::AtomicI64,
}
impl std::fmt::Display for ProxyEntry {
@@ -102,7 +102,7 @@ impl std::fmt::Display for ProxyEntry {
if !self.add_headers.is_empty() {
write!(f, " +Headers: {:?}", self.add_headers)?;
}
- write!(f, " ({})", self.calls.load(atomic::Ordering::Relaxed))
+ Ok(())
}
}
@@ -167,7 +167,8 @@ fn parse_tricot_tag(
path_prefix,
priority,
add_headers: add_headers.to_vec(),
- calls: atomic::AtomicI64::from(0),
+ last_call: atomic::AtomicI64::from(0),
+ calls_in_progress: atomic::AtomicI64::from(0),
})
}