Skip to content

Use async RwLock for the VC's initialized_validators #7423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: unstable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions common/warp_utils/src/task.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::reject::convert_rejection;
use serde::Serialize;
use std::future::Future;
use warp::reply::{Reply, Response};

/// A convenience wrapper around `blocking_task`.
Expand Down Expand Up @@ -38,3 +39,13 @@ where

convert_rejection(result).await
}

/// Async variant of `blocking_json_task`, which handles JSONification and error conversion.
pub async fn async_json_task<F, T>(fut: F) -> Response
where
F: Future<Output = Result<T, warp::Rejection>>,
T: Serialize + Send + 'static,
{
let result = fut.await.map(|response| warp::reply::json(&response));
convert_rejection(result).await
}
Loading
Loading