mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 19:42:27 +08:00
refactor(dynamic_routing): remove tenant-id prefixed in id field of dynamic routing grpc requests (#6949)
This commit is contained in:
@ -1347,14 +1347,9 @@ pub async fn perform_success_based_routing(
|
||||
.ok_or(errors::RoutingError::SuccessBasedRoutingParamsNotFoundError)?,
|
||||
);
|
||||
|
||||
let tenant_business_profile_id = routing::helpers::generate_tenant_business_profile_id(
|
||||
&state.tenant.redis_key_prefix,
|
||||
business_profile.get_id().get_string_repr(),
|
||||
);
|
||||
|
||||
let success_based_connectors: CalSuccessRateResponse = client
|
||||
.calculate_success_rate(
|
||||
tenant_business_profile_id,
|
||||
business_profile.get_id().get_string_repr().into(),
|
||||
success_based_routing_configs,
|
||||
success_based_routing_config_params,
|
||||
routable_connectors,
|
||||
|
||||
@ -1397,10 +1397,6 @@ pub async fn success_based_routing_update_configs(
|
||||
router_env::metric_attributes!(("profile_id", profile_id.clone())),
|
||||
);
|
||||
|
||||
let prefix_of_dynamic_routing_keys = helpers::generate_tenant_business_profile_id(
|
||||
&state.tenant.redis_key_prefix,
|
||||
profile_id.get_string_repr(),
|
||||
);
|
||||
state
|
||||
.grpc_client
|
||||
.dynamic_routing
|
||||
@ -1409,7 +1405,7 @@ pub async fn success_based_routing_update_configs(
|
||||
.async_map(|sr_client| async {
|
||||
sr_client
|
||||
.invalidate_success_rate_routing_keys(
|
||||
prefix_of_dynamic_routing_keys,
|
||||
profile_id.get_string_repr().into(),
|
||||
state.get_grpc_headers(),
|
||||
)
|
||||
.await
|
||||
|
||||
@ -699,11 +699,6 @@ pub async fn push_metrics_with_update_window_for_success_based_routing(
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("unable to retrieve success_rate based dynamic routing configs")?;
|
||||
|
||||
let tenant_business_profile_id = generate_tenant_business_profile_id(
|
||||
&state.tenant.redis_key_prefix,
|
||||
business_profile.get_id().get_string_repr(),
|
||||
);
|
||||
|
||||
let success_based_routing_config_params = success_based_routing_config_params_interpolator
|
||||
.get_string_val(
|
||||
success_based_routing_configs
|
||||
@ -715,7 +710,7 @@ pub async fn push_metrics_with_update_window_for_success_based_routing(
|
||||
|
||||
let success_based_connectors = client
|
||||
.calculate_success_rate(
|
||||
tenant_business_profile_id.clone(),
|
||||
business_profile.get_id().get_string_repr().into(),
|
||||
success_based_routing_configs.clone(),
|
||||
success_based_routing_config_params.clone(),
|
||||
routable_connectors.clone(),
|
||||
@ -841,7 +836,7 @@ pub async fn push_metrics_with_update_window_for_success_based_routing(
|
||||
|
||||
client
|
||||
.update_success_rate(
|
||||
tenant_business_profile_id,
|
||||
business_profile.get_id().get_string_repr().into(),
|
||||
success_based_routing_configs,
|
||||
success_based_routing_config_params,
|
||||
vec![routing_types::RoutableConnectorChoiceWithStatus::new(
|
||||
@ -936,14 +931,6 @@ fn get_success_based_metrics_outcome_for_payment(
|
||||
}
|
||||
}
|
||||
|
||||
/// generates cache key with tenant's redis key prefix and profile_id
|
||||
pub fn generate_tenant_business_profile_id(
|
||||
redis_key_prefix: &str,
|
||||
business_profile_id: &str,
|
||||
) -> String {
|
||||
format!("{}:{}", redis_key_prefix, business_profile_id)
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v1", feature = "dynamic_routing"))]
|
||||
pub async fn disable_dynamic_routing_algorithm(
|
||||
state: &SessionState,
|
||||
|
||||
Reference in New Issue
Block a user