gitdataai/libs/service/git/blocking.rs
2026-04-15 09:08:09 +08:00

16 lines
473 B
Rust

#[macro_export]
macro_rules! git_spawn {
($repo:expr, $domain:ident -> $body:expr) => {{
let repo_clone = $repo.clone();
tokio::task::spawn_blocking(move || {
let $domain = git::GitDomain::from_model(repo_clone)?;
$body
})
.await
.map_err(|e| {
crate::error::AppError::InternalServerError(format!("Task join error: {}", e))
})?
.map_err(crate::error::AppError::from)
}};
}