fix 100% cpu

This commit is contained in:
MeexReay 2025-04-10 15:27:02 +03:00
parent 614e1900b7
commit f65a496d51
2 changed files with 5 additions and 9 deletions

View File

@ -37,7 +37,7 @@ impl FlowgateServer {
FlowgateServer { config } FlowgateServer { config }
} }
pub async fn start(self) { pub async fn run(self) {
let local_self = Arc::new(self); let local_self = Arc::new(self);
tokio::spawn({ tokio::spawn({
@ -45,10 +45,7 @@ impl FlowgateServer {
async move { local_self.run_http().await.ignore(); } async move { local_self.run_http().await.ignore(); }
}); });
tokio::spawn({ local_self.run_https().await.ignore();
let local_self = local_self.clone();
async move { local_self.run_https().await.ignore(); }
});
} }
pub async fn run_http(self: Arc<Self>) -> Result<(), Box<dyn Error>> { pub async fn run_http(self: Arc<Self>) -> Result<(), Box<dyn Error>> {

View File

@ -14,7 +14,6 @@ async fn main() {
let config = Arc::new(Config::parse("conf.yml").unwrap()); let config = Arc::new(Config::parse("conf.yml").unwrap());
let server = FlowgateServer::new(config.clone()); let server = FlowgateServer::new(config.clone());
server.start().await; // server.start().await;
server.run().await;
loop {}
} }