make async-backtrace optional

This commit is contained in:
Igor Katson 2024-08-19 13:40:01 +01:00
parent 17353cf8e1
commit e4aac7930f
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
4 changed files with 44 additions and 21 deletions

View file

@ -85,7 +85,17 @@ impl TestPeerMetadata {
async fn debug_server() -> anyhow::Result<()> {
async fn backtraces() -> impl IntoResponse {
async_backtrace::taskdump_tree(true)
#[cfg(feature = "async-bt")]
{
async_backtrace::taskdump_tree(true)
}
#[cfg(not(feature = "async-bt"))]
{
use crate::ApiError;
ApiError::from(anyhow::anyhow!(
"backtraces not enabled, enable async-bt feature"
))
}
}
let app = Router::new().route("/backtrace", get(backtraces));