Skip to content

Commit

Permalink
fix: format
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-gorules committed Jul 17, 2024
1 parent 208ab2f commit be5e5c3
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions backend/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use std::env;
use std::path::Path;
use std::thread::available_parallelism;
use axum::extract::DefaultBodyLimit;
use axum::http::StatusCode;
use axum::response::{IntoResponse, Response};
use axum::routing::{get, post};
use axum::{Extension, Json, Router};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::env;
use std::path::Path;
use std::thread::available_parallelism;
use tokio::runtime::Handle;
use tokio_util::task::LocalPoolHandle;
use tower_http::compression::CompressionLayer;
Expand Down Expand Up @@ -90,15 +90,20 @@ async fn simulate(
let engine = DecisionEngine::default();
let decision = engine.create_decision(payload.content.into());

let result = local_pool.spawn_pinned(move || async move {
decision.evaluate_with_opts(
&payload.context,
EvaluationOptions {
trace: Some(true),
max_depth: None,
},
).await
}).await.expect("Thread failed to join")?;
let result = local_pool
.spawn_pinned(move || async move {
decision
.evaluate_with_opts(
&payload.context,
EvaluationOptions {
trace: Some(true),
max_depth: None,
},
)
.await
})
.await
.expect("Thread failed to join")?;

return Ok(Json(result));
}
Expand Down

0 comments on commit be5e5c3

Please sign in to comment.