mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 21:07:58 +08:00
chore: added tokio::spawn to make things parallel
This commit is contained in:
@ -528,7 +528,7 @@ where
|
|||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
|
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
|
||||||
#[instrument(skip_all, fields(payment_id, merchant_id))]
|
#[instrument(skip_all, fields(payment_id, merchant_id))]
|
||||||
pub async fn payments_operation_core<F, Req, Op, FData, D>(
|
pub async fn payments_operation_core<'a, F, Req, Op, FData, D>(
|
||||||
state: &SessionState,
|
state: &SessionState,
|
||||||
req_state: ReqState,
|
req_state: ReqState,
|
||||||
merchant_context: &domain::MerchantContext,
|
merchant_context: &domain::MerchantContext,
|
||||||
@ -541,7 +541,7 @@ pub async fn payments_operation_core<F, Req, Op, FData, D>(
|
|||||||
header_payload: HeaderPayload,
|
header_payload: HeaderPayload,
|
||||||
) -> RouterResult<(D, Req, Option<domain::Customer>, Option<u16>, Option<u128>)>
|
) -> RouterResult<(D, Req, Option<domain::Customer>, Option<u16>, Option<u128>)>
|
||||||
where
|
where
|
||||||
F: Send + Clone + Sync,
|
F: Send + Clone + Sync + 'static + 'a,
|
||||||
Req: Authenticate + Clone,
|
Req: Authenticate + Clone,
|
||||||
Op: Operation<F, Req, Data = D> + Send + Sync,
|
Op: Operation<F, Req, Data = D> + Send + Sync,
|
||||||
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
|
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
|
||||||
@ -556,7 +556,7 @@ where
|
|||||||
|
|
||||||
// To perform router related operation for PaymentResponse
|
// To perform router related operation for PaymentResponse
|
||||||
PaymentResponse: Operation<F, FData, Data = D>,
|
PaymentResponse: Operation<F, FData, Data = D>,
|
||||||
FData: Send + Sync + Clone + router_types::Capturable,
|
FData: Send + Sync + Clone + router_types::Capturable + 'static + 'a,
|
||||||
{
|
{
|
||||||
let operation: BoxedOperation<'_, F, Req, D> = Box::new(operation);
|
let operation: BoxedOperation<'_, F, Req, D> = Box::new(operation);
|
||||||
|
|
||||||
@ -2081,7 +2081,7 @@ pub async fn call_surcharge_decision_management_for_session_flow(
|
|||||||
|
|
||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub async fn payments_core<F, Res, Req, Op, FData, D>(
|
pub async fn payments_core<'a, F, Res, Req, Op, FData, D>(
|
||||||
state: SessionState,
|
state: SessionState,
|
||||||
req_state: ReqState,
|
req_state: ReqState,
|
||||||
merchant_context: domain::MerchantContext,
|
merchant_context: domain::MerchantContext,
|
||||||
@ -2094,8 +2094,8 @@ pub async fn payments_core<F, Res, Req, Op, FData, D>(
|
|||||||
header_payload: HeaderPayload,
|
header_payload: HeaderPayload,
|
||||||
) -> RouterResponse<Res>
|
) -> RouterResponse<Res>
|
||||||
where
|
where
|
||||||
F: Send + Clone + Sync,
|
F: Send + Clone + Sync + 'static + 'a,
|
||||||
FData: Send + Sync + Clone + router_types::Capturable,
|
FData: Send + Sync + Clone + router_types::Capturable + 'static + 'a,
|
||||||
Op: Operation<F, Req, Data = D> + Send + Sync + Clone,
|
Op: Operation<F, Req, Data = D> + Send + Sync + Clone,
|
||||||
Req: Debug + Authenticate + Clone,
|
Req: Debug + Authenticate + Clone,
|
||||||
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
|
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
|
||||||
@ -4213,20 +4213,20 @@ where
|
|||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
#[instrument(skip_all)]
|
#[instrument(skip_all)]
|
||||||
pub async fn decide_unified_connector_service_call<F, RouterDReq, ApiRequest, D>(
|
pub async fn decide_unified_connector_service_call<'a, F, RouterDReq, ApiRequest, D>(
|
||||||
state: &SessionState,
|
state: &'a SessionState,
|
||||||
req_state: ReqState,
|
req_state: ReqState,
|
||||||
merchant_context: &domain::MerchantContext,
|
merchant_context: &'a domain::MerchantContext,
|
||||||
connector: api::ConnectorData,
|
connector: api::ConnectorData,
|
||||||
operation: &BoxedOperation<'_, F, ApiRequest, D>,
|
operation: &'a BoxedOperation<'a, F, ApiRequest, D>,
|
||||||
payment_data: &mut D,
|
payment_data: &'a mut D,
|
||||||
customer: &Option<domain::Customer>,
|
customer: &Option<domain::Customer>,
|
||||||
call_connector_action: CallConnectorAction,
|
call_connector_action: CallConnectorAction,
|
||||||
validate_result: &operations::ValidateResult,
|
validate_result: &'a operations::ValidateResult,
|
||||||
schedule_time: Option<time::PrimitiveDateTime>,
|
schedule_time: Option<time::PrimitiveDateTime>,
|
||||||
header_payload: HeaderPayload,
|
header_payload: HeaderPayload,
|
||||||
frm_suggestion: Option<storage_enums::FrmSuggestion>,
|
frm_suggestion: Option<storage_enums::FrmSuggestion>,
|
||||||
business_profile: &domain::Profile,
|
business_profile: &'a domain::Profile,
|
||||||
is_retry_payment: bool,
|
is_retry_payment: bool,
|
||||||
all_keys_required: Option<bool>,
|
all_keys_required: Option<bool>,
|
||||||
merchant_connector_account: helpers::MerchantConnectorAccountType,
|
merchant_connector_account: helpers::MerchantConnectorAccountType,
|
||||||
@ -4237,8 +4237,8 @@ pub async fn decide_unified_connector_service_call<F, RouterDReq, ApiRequest, D>
|
|||||||
helpers::MerchantConnectorAccountType,
|
helpers::MerchantConnectorAccountType,
|
||||||
)>
|
)>
|
||||||
where
|
where
|
||||||
F: Send + Clone + Sync,
|
F: Send + Clone + Sync + 'static + 'a,
|
||||||
RouterDReq: Send + Sync + Clone,
|
RouterDReq: Send + Sync + Clone + 'static + 'a,
|
||||||
|
|
||||||
// To create connector flow specific interface data
|
// To create connector flow specific interface data
|
||||||
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
|
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
|
||||||
@ -4326,16 +4326,21 @@ where
|
|||||||
.get_string_repr(),
|
.get_string_repr(),
|
||||||
payment_data.get_payment_attempt().attempt_id
|
payment_data.get_payment_attempt().attempt_id
|
||||||
);
|
);
|
||||||
|
let ucs_merchant_connector_account = merchant_connector_account.clone();
|
||||||
|
let ucs_merchant_context = merchant_context.clone();
|
||||||
|
|
||||||
// Update feature metadata to track Direct routing usage for stickiness
|
// Update feature metadata to track Direct routing usage for stickiness
|
||||||
update_gateway_system_in_feature_metadata(payment_data, GatewaySystem::Direct)?;
|
update_gateway_system_in_feature_metadata(payment_data, GatewaySystem::Direct)?;
|
||||||
let _result = rd
|
let ucs_state = state.clone();
|
||||||
.call_unified_connector_service(
|
tokio::spawn(async move {
|
||||||
state,
|
let _result = rd
|
||||||
merchant_connector_account.clone(),
|
.call_unified_connector_service(
|
||||||
merchant_context,
|
&ucs_state,
|
||||||
)
|
ucs_merchant_connector_account,
|
||||||
.await?;
|
&ucs_merchant_context,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
});
|
||||||
|
|
||||||
call_connector_service(
|
call_connector_service(
|
||||||
state,
|
state,
|
||||||
|
|||||||
@ -32,7 +32,7 @@ use crate::{
|
|||||||
#[instrument(skip_all)]
|
#[instrument(skip_all)]
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
pub async fn do_gsm_actions<F, ApiRequest, FData, D>(
|
pub async fn do_gsm_actions<'a, F, ApiRequest, FData, D>(
|
||||||
state: &app::SessionState,
|
state: &app::SessionState,
|
||||||
req_state: ReqState,
|
req_state: ReqState,
|
||||||
payment_data: &mut D,
|
payment_data: &mut D,
|
||||||
@ -48,8 +48,8 @@ pub async fn do_gsm_actions<F, ApiRequest, FData, D>(
|
|||||||
business_profile: &domain::Profile,
|
business_profile: &domain::Profile,
|
||||||
) -> RouterResult<types::RouterData<F, FData, types::PaymentsResponseData>>
|
) -> RouterResult<types::RouterData<F, FData, types::PaymentsResponseData>>
|
||||||
where
|
where
|
||||||
F: Clone + Send + Sync,
|
F: Clone + Send + Sync + 'static + 'a,
|
||||||
FData: Send + Sync + types::Capturable + Clone,
|
FData: Send + Sync + types::Capturable + Clone + 'static + 'a,
|
||||||
payments::PaymentResponse: operations::Operation<F, FData>,
|
payments::PaymentResponse: operations::Operation<F, FData>,
|
||||||
D: payments::OperationSessionGetters<F>
|
D: payments::OperationSessionGetters<F>
|
||||||
+ payments::OperationSessionSetters<F>
|
+ payments::OperationSessionSetters<F>
|
||||||
@ -338,14 +338,14 @@ fn get_flow_name<F>() -> RouterResult<String> {
|
|||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
#[instrument(skip_all)]
|
#[instrument(skip_all)]
|
||||||
pub async fn do_retry<F, ApiRequest, FData, D>(
|
pub async fn do_retry<'a, F, ApiRequest, FData, D>(
|
||||||
state: &routes::SessionState,
|
state: &'a routes::SessionState,
|
||||||
req_state: ReqState,
|
req_state: ReqState,
|
||||||
connector: &api::ConnectorData,
|
connector: &'a api::ConnectorData,
|
||||||
operation: &operations::BoxedOperation<'_, F, ApiRequest, D>,
|
operation: &'a operations::BoxedOperation<'a, F, ApiRequest, D>,
|
||||||
customer: &Option<domain::Customer>,
|
customer: &'a Option<domain::Customer>,
|
||||||
merchant_context: &domain::MerchantContext,
|
merchant_context: &domain::MerchantContext,
|
||||||
payment_data: &mut D,
|
payment_data: &'a mut D,
|
||||||
router_data: types::RouterData<F, FData, types::PaymentsResponseData>,
|
router_data: types::RouterData<F, FData, types::PaymentsResponseData>,
|
||||||
validate_result: &operations::ValidateResult,
|
validate_result: &operations::ValidateResult,
|
||||||
schedule_time: Option<time::PrimitiveDateTime>,
|
schedule_time: Option<time::PrimitiveDateTime>,
|
||||||
@ -356,8 +356,8 @@ pub async fn do_retry<F, ApiRequest, FData, D>(
|
|||||||
routing_decision: Option<routing_helpers::RoutingDecisionData>,
|
routing_decision: Option<routing_helpers::RoutingDecisionData>,
|
||||||
) -> RouterResult<types::RouterData<F, FData, types::PaymentsResponseData>>
|
) -> RouterResult<types::RouterData<F, FData, types::PaymentsResponseData>>
|
||||||
where
|
where
|
||||||
F: Clone + Send + Sync,
|
F: Clone + Send + Sync + 'static + 'a,
|
||||||
FData: Send + Sync + types::Capturable + Clone,
|
FData: Send + Sync + types::Capturable + Clone + 'static + 'a,
|
||||||
payments::PaymentResponse: operations::Operation<F, FData>,
|
payments::PaymentResponse: operations::Operation<F, FData>,
|
||||||
D: payments::OperationSessionGetters<F>
|
D: payments::OperationSessionGetters<F>
|
||||||
+ payments::OperationSessionSetters<F>
|
+ payments::OperationSessionSetters<F>
|
||||||
|
|||||||
Reference in New Issue
Block a user