mirror of
https://github.com/cjfranko/NTP-Timeturner.git
synced 2025-11-08 18:32:02 +00:00
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:
parent
0325c3b570
commit
c94e1ea4b0
1 changed files with 2 additions and 1 deletions
|
|
@ -18,6 +18,7 @@ use std::{
|
||||||
sync::{Arc, Mutex, mpsc},
|
sync::{Arc, Mutex, mpsc},
|
||||||
thread,
|
thread,
|
||||||
};
|
};
|
||||||
|
use tokio::task;
|
||||||
|
|
||||||
/// Embed the default config.json at compile time.
|
/// Embed the default config.json at compile time.
|
||||||
const DEFAULT_CONFIG: &str = include_str!("../config.json");
|
const DEFAULT_CONFIG: &str = include_str!("../config.json");
|
||||||
|
|
@ -80,7 +81,7 @@ async fn main() {
|
||||||
{
|
{
|
||||||
let api_state = ltc_state.clone();
|
let api_state = ltc_state.clone();
|
||||||
let offset_clone = hw_offset.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 {
|
if let Err(e) = start_api_server(api_state, offset_clone).await {
|
||||||
eprintln!("API server error: {}", e);
|
eprintln!("API server error: {}", e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue