mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-03-13 06:09:06 +00:00
Fixed warnings when compiling for Windows (#300)
This commit is contained in:
parent
37a9046be4
commit
0c4b94c527
@ -1,4 +1,3 @@
|
|||||||
use std::collections::HashSet;
|
|
||||||
use log::info;
|
use log::info;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use rocket::config::Shutdown;
|
use rocket::config::Shutdown;
|
||||||
@ -26,21 +25,8 @@ pub fn start_runtime_api() {
|
|||||||
let api_port = *API_SERVER_PORT;
|
let api_port = *API_SERVER_PORT;
|
||||||
info!("Try to start the API server on 'http://localhost:{api_port}'...");
|
info!("Try to start the API server on 'http://localhost:{api_port}'...");
|
||||||
|
|
||||||
// The shutdown configuration for the runtime API server:
|
// Get the shutdown configuration:
|
||||||
let mut shutdown = Shutdown {
|
let shutdown = create_shutdown();
|
||||||
// We do not want to use the Ctrl+C signal to stop the server:
|
|
||||||
ctrlc: false,
|
|
||||||
|
|
||||||
// Everything else is set to default for now:
|
|
||||||
..Shutdown::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
#[cfg(unix)]
|
|
||||||
{
|
|
||||||
// We do not want to use the termination signal to stop the server.
|
|
||||||
// This option, however, is only available on Unix systems:
|
|
||||||
shutdown.signals = HashSet::new();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configure the runtime API server:
|
// Configure the runtime API server:
|
||||||
let figment = Figment::from(rocket::Config::release_default())
|
let figment = Figment::from(rocket::Config::release_default())
|
||||||
@ -96,3 +82,34 @@ pub fn start_runtime_api() {
|
|||||||
.launch().await.unwrap();
|
.launch().await.unwrap();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn create_shutdown() -> Shutdown {
|
||||||
|
//
|
||||||
|
// Create a shutdown configuration, depending on the operating system:
|
||||||
|
//
|
||||||
|
#[cfg(unix)]
|
||||||
|
{
|
||||||
|
use std::collections::HashSet;
|
||||||
|
let mut shutdown = Shutdown {
|
||||||
|
// We do not want to use the Ctrl+C signal to stop the server:
|
||||||
|
ctrlc: false,
|
||||||
|
|
||||||
|
// Everything else is set to default for now:
|
||||||
|
..Shutdown::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
shutdown.signals = HashSet::new();
|
||||||
|
shutdown
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
{
|
||||||
|
Shutdown {
|
||||||
|
// We do not want to use the Ctrl+C signal to stop the server:
|
||||||
|
ctrlc: false,
|
||||||
|
|
||||||
|
// Everything else is set to default for now:
|
||||||
|
..Shutdown::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user