feat: change async-bb8 fork and tokio spawn for concurrent database calls (#2774)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: akshay-97 <adiosphobian@gmail.com>
Co-authored-by: akshay.s <akshay.s@juspay.in>
Co-authored-by: Kartikeya Hegde <karthikey.hegde@juspay.in>
This commit is contained in:
Arun Raj M
2023-11-16 10:27:34 +05:30
committed by GitHub
parent 496245d990
commit d634fdeac3
69 changed files with 1516 additions and 721 deletions

View File

@ -753,9 +753,11 @@ where
if let services::ApplicationResponse::JsonWithHeaders((payments_response_json, _)) =
payments_response
{
let m_state = state.clone();
Box::pin(
webhooks_core::create_event_and_trigger_appropriate_outgoing_webhook(
state.clone(),
m_state,
merchant_account,
business_profile,
event_type,
@ -772,3 +774,16 @@ where
Ok(())
}
type Handle<T> = tokio::task::JoinHandle<RouterResult<T>>;
pub async fn flatten_join_error<T>(handle: Handle<T>) -> RouterResult<T> {
match handle.await {
Ok(Ok(t)) => Ok(t),
Ok(Err(err)) => Err(err),
Err(err) => Err(err)
.into_report()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Join Error"),
}
}