fix: use spawn_local to run non-Send API server task

Co-authored-by: aider (gemini/gemini-2.5-pro-preview-05-06) <aider@aider.chat>
This commit is contained in:
Chaos Rogers 2025-07-21 16:49:35 +01:00
parent 0325c3b570
commit c94e1ea4b0

View file

@ -18,6 +18,7 @@ use std::{
sync::{Arc, Mutex, mpsc},
thread,
};
use tokio::task;
/// Embed the default config.json at compile time.
const DEFAULT_CONFIG: &str = include_str!("../config.json");
@ -80,7 +81,7 @@ async fn main() {
{
let api_state = ltc_state.clone();
let offset_clone = hw_offset.clone();
tokio::spawn(async move {
task::spawn_local(async move {
if let Err(e) = start_api_server(api_state, offset_clone).await {
eprintln!("API server error: {}", e);
}