refactor: only start actor system when server starts
All checks were successful
Rust / build (push) Successful in 1m27s
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/cron/cron-docker-builder Pipeline was successful
ci/woodpecker/cron/push-next Pipeline was successful
ci/woodpecker/cron/tag-created Pipeline was successful
All checks were successful
Rust / build (push) Successful in 1m27s
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/cron/cron-docker-builder Pipeline was successful
ci/woodpecker/cron/push-next Pipeline was successful
ci/woodpecker/cron/tag-created Pipeline was successful
This commit is contained in:
parent
77d35e8a09
commit
dfc0c1dc80
3 changed files with 26 additions and 21 deletions
|
@ -13,9 +13,6 @@ clap = { workspace = true }
|
||||||
# fs/network
|
# fs/network
|
||||||
kxio = { workspace = true }
|
kxio = { workspace = true }
|
||||||
|
|
||||||
# Actors
|
|
||||||
actix-rt = { workspace = true }
|
|
||||||
|
|
||||||
[lints.clippy]
|
[lints.clippy]
|
||||||
nursery = { level = "warn", priority = -1 }
|
nursery = { level = "warn", priority = -1 }
|
||||||
# pedantic = "warn"
|
# pedantic = "warn"
|
||||||
|
|
|
@ -26,8 +26,7 @@ enum Server {
|
||||||
Start,
|
Start,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_rt::main]
|
fn main() {
|
||||||
async fn main() {
|
|
||||||
let fs = fs::new(PathBuf::default());
|
let fs = fs::new(PathBuf::default());
|
||||||
let net = Network::new_real();
|
let net = Network::new_real();
|
||||||
let repo = git_next_git::repository::real();
|
let repo = git_next_git::repository::real();
|
||||||
|
@ -43,7 +42,7 @@ async fn main() {
|
||||||
}
|
}
|
||||||
Server::Start => {
|
Server::Start => {
|
||||||
let sleep_duration = std::time::Duration::from_secs(10);
|
let sleep_duration = std::time::Duration::from_secs(10);
|
||||||
git_next_server::start(fs, net, repo, sleep_duration).await;
|
git_next_server::start(fs, net, repo, sleep_duration);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ pub fn init(fs: FileSystem) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn start(
|
pub fn start(
|
||||||
fs: FileSystem,
|
fs: FileSystem,
|
||||||
net: Network,
|
net: Network,
|
||||||
repo: Box<dyn RepositoryFactory>,
|
repo: Box<dyn RepositoryFactory>,
|
||||||
|
@ -39,6 +39,8 @@ pub async fn start(
|
||||||
init_logging();
|
init_logging();
|
||||||
|
|
||||||
info!("Starting Server...");
|
info!("Starting Server...");
|
||||||
|
let execution = async move {
|
||||||
|
//-
|
||||||
let server = Server::new(fs.clone(), net.clone(), repo, sleep_duration).start();
|
let server = Server::new(fs.clone(), net.clone(), repo, sleep_duration).start();
|
||||||
server.do_send(FileUpdated);
|
server.do_send(FileUpdated);
|
||||||
|
|
||||||
|
@ -55,6 +57,13 @@ pub async fn start(
|
||||||
info!("Server running - Press Ctrl-C to stop...");
|
info!("Server running - Press Ctrl-C to stop...");
|
||||||
let _ = actix_rt::signal::ctrl_c().await;
|
let _ = actix_rt::signal::ctrl_c().await;
|
||||||
info!("Ctrl-C received, shutting down...");
|
info!("Ctrl-C received, shutting down...");
|
||||||
|
System::current().stop();
|
||||||
|
};
|
||||||
|
let system = System::new();
|
||||||
|
Arbiter::current().spawn(execution);
|
||||||
|
if let Err(err) = system.run() {
|
||||||
|
tracing::error!(?err, "")
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init_logging() {
|
pub fn init_logging() {
|
||||||
|
|
Loading…
Reference in a new issue