mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 09:38:33 +08:00
Merge branch 'mitm_proxy' of github.com:juspay/hyperswitch into mitm_proxy
This commit is contained in:
@ -2143,7 +2143,8 @@ pub async fn should_execute_based_on_rollout(
|
|||||||
match db.find_config_by_key(config_key).await {
|
match db.find_config_by_key(config_key).await {
|
||||||
Ok(rollout_config) => {
|
Ok(rollout_config) => {
|
||||||
// Try to parse as JSON first (new format), fallback to float (legacy format)
|
// Try to parse as JSON first (new format), fallback to float (legacy format)
|
||||||
let config_result = match serde_json::from_str::<RolloutConfig>(&rollout_config.config) {
|
let config_result = match serde_json::from_str::<RolloutConfig>(&rollout_config.config)
|
||||||
|
{
|
||||||
Ok(config) => Ok(config),
|
Ok(config) => Ok(config),
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
// Fallback to legacy format (simple float)
|
// Fallback to legacy format (simple float)
|
||||||
@ -2167,14 +2168,15 @@ pub async fn should_execute_based_on_rollout(
|
|||||||
rollout_percent = config.rollout_percent,
|
rollout_percent = config.rollout_percent,
|
||||||
"Rollout percent out of bounds. Must be between 0.0 and 1.0"
|
"Rollout percent out of bounds. Must be between 0.0 and 1.0"
|
||||||
);
|
);
|
||||||
let proxy_override = if config.http_url.is_some() || config.https_url.is_some() {
|
let proxy_override =
|
||||||
Some(ProxyOverride {
|
if config.http_url.is_some() || config.https_url.is_some() {
|
||||||
http_url: config.http_url,
|
Some(ProxyOverride {
|
||||||
https_url: config.https_url,
|
http_url: config.http_url,
|
||||||
})
|
https_url: config.https_url,
|
||||||
} else {
|
})
|
||||||
None
|
} else {
|
||||||
};
|
None
|
||||||
|
};
|
||||||
|
|
||||||
return Ok(RolloutExecutionResult {
|
return Ok(RolloutExecutionResult {
|
||||||
should_execute: false,
|
should_execute: false,
|
||||||
@ -2186,7 +2188,8 @@ pub async fn should_execute_based_on_rollout(
|
|||||||
let should_execute = sampled_value < config.rollout_percent;
|
let should_execute = sampled_value < config.rollout_percent;
|
||||||
|
|
||||||
// Create proxy override if URLs are available
|
// Create proxy override if URLs are available
|
||||||
let proxy_override = if config.http_url.is_some() || config.https_url.is_some() {
|
let proxy_override = if config.http_url.is_some() || config.https_url.is_some()
|
||||||
|
{
|
||||||
if let Some(ref http_url) = config.http_url {
|
if let Some(ref http_url) = config.http_url {
|
||||||
logger::info!(http_url = %http_url, "Using HTTP proxy URL from rollout config");
|
logger::info!(http_url = %http_url, "Using HTTP proxy URL from rollout config");
|
||||||
}
|
}
|
||||||
@ -2214,7 +2217,7 @@ pub async fn should_execute_based_on_rollout(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
logger::error!(error = ?err, "Failed to fetch rollout config from DB");
|
logger::error!(error = ?err, "Failed to fetch rollout config from DB");
|
||||||
Ok(RolloutExecutionResult {
|
Ok(RolloutExecutionResult {
|
||||||
|
|||||||
Reference in New Issue
Block a user