Explicitely start async executor
This commit is contained in:
parent
1c84cde158
commit
289827d6a3
2 changed files with 21 additions and 17 deletions
26
src/main.rs
26
src/main.rs
|
@ -217,18 +217,20 @@ fn main() -> Result<()> {
|
||||||
.unwrap_or_else(|| "5050".to_owned())
|
.unwrap_or_else(|| "5050".to_owned())
|
||||||
.parse()
|
.parse()
|
||||||
.with_context(|| "Invalid port number")?;
|
.with_context(|| "Invalid port number")?;
|
||||||
|
let db_server = db.clone();
|
||||||
service::server::run(
|
std::thread::spawn(move || {
|
||||||
port,
|
let _ = service::server::run(
|
||||||
Some(auth_secret.as_slice()),
|
port,
|
||||||
api_url,
|
Some(auth_secret.as_slice()),
|
||||||
web_url,
|
api_url,
|
||||||
web_dir_path,
|
web_url,
|
||||||
swagger_url,
|
web_dir_path,
|
||||||
swagger_dir_path,
|
swagger_url,
|
||||||
db.clone(),
|
swagger_dir_path,
|
||||||
command_sender,
|
db_server,
|
||||||
)?;
|
command_sender,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
// Start DDNS updates
|
// Start DDNS updates
|
||||||
let db_ddns = db.clone();
|
let db_ddns = db.clone();
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use actix_rt::System;
|
||||||
use actix_web::{App, HttpServer};
|
use actix_web::{App, HttpServer};
|
||||||
use anyhow::*;
|
use anyhow::*;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
@ -6,8 +7,7 @@ use std::sync::Arc;
|
||||||
use crate::db::DB;
|
use crate::db::DB;
|
||||||
use crate::index::CommandSender;
|
use crate::index::CommandSender;
|
||||||
|
|
||||||
#[actix_rt::main]
|
pub fn run(
|
||||||
pub async fn run(
|
|
||||||
port: u16,
|
port: u16,
|
||||||
auth_secret: Option<&[u8]>,
|
auth_secret: Option<&[u8]>,
|
||||||
api_url: String,
|
api_url: String,
|
||||||
|
@ -18,7 +18,9 @@ pub async fn run(
|
||||||
db: DB,
|
db: DB,
|
||||||
command_sender: Arc<CommandSender>,
|
command_sender: Arc<CommandSender>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
HttpServer::new(move || {
|
let mut sys = System::new("polaris_service_executor");
|
||||||
|
|
||||||
|
let server = HttpServer::new(move || {
|
||||||
App::new().configure(|cfg| {
|
App::new().configure(|cfg| {
|
||||||
super::configure_app(
|
super::configure_app(
|
||||||
cfg,
|
cfg,
|
||||||
|
@ -30,8 +32,8 @@ pub async fn run(
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.bind(format!("127.0.0.1:{}", port))?
|
.bind(format!("0.0.0.0:{}", port))?
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
Ok(())
|
sys.block_on(server).map_err(Error::new)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue