Skip to content

Commit

Permalink
chore: run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperswitch-bot[bot] committed Dec 16, 2024
1 parent 584db45 commit a1732d4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
5 changes: 4 additions & 1 deletion crates/external_services/src/grpc_client/dynamic_routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ impl DynamicRoutingClientConfig {
client.clone(),
uri.clone(),
)),
Some(ContractScoreCalculatorClient::with_origin(client.clone(), uri.clone())),
Some(ContractScoreCalculatorClient::with_origin(
client.clone(),
uri.clone(),
)),
Some(EliminationAnalyserClient::with_origin(client, uri)),
)
}
Expand Down
5 changes: 4 additions & 1 deletion crates/router/src/core/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,10 @@ pub async fn contract_based_dynamic_routing_setup(

metrics::ROUTING_CREATE_SUCCESS_RESPONSE.add(
1,
router_env::metric_attributes!(("profile_id", profile_id.get_string_repr().to_string())),
router_env::metric_attributes!((
"profile_id",
profile_id.get_string_repr().to_string()
)),
);
Ok(service_api::ApplicationResponse::Json(new_record))
}
Expand Down
32 changes: 16 additions & 16 deletions crates/router/src/core/routing/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ use diesel_models::routing_algorithm;
use error_stack::ResultExt;
#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
use external_services::grpc_client::dynamic_routing::{
contract_routing_client::ContractBasedDynamicRouting, success_rate_client::SuccessBasedDynamicRouting,
contract_routing_client::ContractBasedDynamicRouting,
success_rate_client::SuccessBasedDynamicRouting,
};
#[cfg(feature = "v1")]
use hyperswitch_domain_models::api::ApplicationResponse;
Expand Down Expand Up @@ -1045,23 +1046,22 @@ pub async fn push_metrics_with_update_window_for_contract_based_routing(
mca_id: final_label_info.mca_id.to_owned(),
};


let payment_status_attribute =
get_desired_payment_status_for_success_routing_metrics(payment_attempt.status);
get_desired_payment_status_for_success_routing_metrics(payment_attempt.status);

if payment_status_attribute == common_enums::AttemptStatus::Charged {
client
.update_contracts(
tenant_business_profile_id.clone(),
vec![request_label_info],
"".to_string(),
vec![],
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable(
"unable to update success based routing window in dynamic routing service",
)?;
.update_contracts(
tenant_business_profile_id.clone(),
vec![request_label_info],
"".to_string(),
vec![],
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable(
"unable to update success based routing window in dynamic routing service",
)?;
}

let contract_scores = client
Expand All @@ -1077,7 +1077,6 @@ pub async fn push_metrics_with_update_window_for_contract_based_routing(
"unable to calculate/fetch contract scores from dynamic routing service",
)?;


let first_contract_based_connector = &contract_scores
.labels_with_score
.first()
Expand Down Expand Up @@ -1159,7 +1158,8 @@ pub async fn push_metrics_with_update_window_for_contract_based_routing(
),
("payment_status", payment_attempt.status.to_string()),
// ("conclusive_classification", outcome.to_string()),
));
),
);
logger::debug!("successfully pushed contract_based_routing metrics");

// let new_contract_config = routing_types::ContractBasedRoutingConfig {
Expand Down

0 comments on commit a1732d4

Please sign in to comment.