Removed unnecessary run from engine
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
pub mod plugin;
|
||||
pub mod command;
|
||||
pub mod plugin;
|
||||
|
||||
use crate::{
|
||||
engine::plugin::StrategyEngine,
|
||||
@@ -35,12 +35,6 @@ impl Engine {
|
||||
}))
|
||||
}
|
||||
|
||||
pub async fn spawn_terminal_server(&self) -> JoinHandle<tokio::io::Result<()>> {
|
||||
let terminal_server = self.terminal_server.clone();
|
||||
|
||||
tokio::spawn(async move { terminal_server.run().await })
|
||||
}
|
||||
|
||||
pub async fn spawn_broadcaster(&self) -> JoinHandle<tokio::io::Result<()>> {
|
||||
let s = self.clone();
|
||||
|
||||
@@ -128,12 +122,6 @@ impl Engine {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn run_engine(&self) -> tokio::io::Result<()> {
|
||||
loop {
|
||||
tokio::time::sleep(tokio::time::Duration::from_millis(5000)).await;
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn invalid_command_usage(&self, name: &str) -> tokio::io::Result<()> {
|
||||
self.terminal_server.error(name, "Invalid usage").await
|
||||
}
|
||||
|
||||
+2
-7
@@ -7,18 +7,13 @@ pub mod terminal;
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
let engine = engine::Engine::new().await?;
|
||||
|
||||
let terminal_server = engine.spawn_terminal_server().await;
|
||||
|
||||
let broadcaster = engine.spawn_broadcaster().await;
|
||||
|
||||
engine.strategy.spawn().await;
|
||||
|
||||
engine.run_engine().await?;
|
||||
engine.terminal_server.run().await?;
|
||||
|
||||
let (terminal_server, broadcaster) = tokio::join!(terminal_server, broadcaster);
|
||||
|
||||
terminal_server??;
|
||||
broadcaster??;
|
||||
broadcaster.await??;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user