mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-08-06 20:49:46 +00:00
perf(easytier-web): improve easytier-web webhook performance (#2383)
* feat(web): reconcile managed config revisions * feat(web): cache managed runtime configs per session * test: cover managed web config delivery
This commit is contained in:
@@ -483,18 +483,22 @@ impl InstanceConfigPatcher {
|
||||
}
|
||||
let global_ctx = weak_upgrade(&self.global_ctx)?;
|
||||
for proxy_network_patch in proxy_networks {
|
||||
let Some(cidr) = proxy_network_patch.cidr.map(|c| c.into()) else {
|
||||
tracing::warn!("Proxy network cidr is None, skipping.");
|
||||
continue;
|
||||
};
|
||||
let mapped_cidr: Option<cidr::Ipv4Cidr> =
|
||||
proxy_network_patch.mapped_cidr.map(|s| s.into());
|
||||
match ConfigPatchAction::try_from(proxy_network_patch.action) {
|
||||
Ok(ConfigPatchAction::Add) => {
|
||||
let Some(cidr) = proxy_network_patch.cidr.map(|c| c.into()) else {
|
||||
tracing::warn!("Proxy network cidr is None, skipping add.");
|
||||
continue;
|
||||
};
|
||||
let mapped_cidr: Option<cidr::Ipv4Cidr> =
|
||||
proxy_network_patch.mapped_cidr.map(|s| s.into());
|
||||
tracing::info!("Proxy network added: {}", cidr);
|
||||
global_ctx.config.add_proxy_cidr(cidr, mapped_cidr)?;
|
||||
}
|
||||
Ok(ConfigPatchAction::Remove) => {
|
||||
let Some(cidr) = proxy_network_patch.cidr.map(|c| c.into()) else {
|
||||
tracing::warn!("Proxy network cidr is None, skipping remove.");
|
||||
continue;
|
||||
};
|
||||
tracing::info!("Proxy network removed: {}", cidr);
|
||||
global_ctx.config.remove_proxy_cidr(cidr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user