forked from kemitix/git-next
parent
53f66d5ee5
commit
869935dfc2
2 changed files with 10 additions and 11 deletions
|
@ -21,7 +21,9 @@ enum Server {
|
|||
Init,
|
||||
Start,
|
||||
}
|
||||
fn main() {
|
||||
|
||||
#[actix_rt::main]
|
||||
async fn main() {
|
||||
let fs = filesystem::FileSystem::new_real(None);
|
||||
let net = Network::new_real();
|
||||
let commands = Commands::parse();
|
||||
|
@ -35,7 +37,7 @@ fn main() {
|
|||
server::init(fs);
|
||||
}
|
||||
Server::Start => {
|
||||
server::start(fs, net);
|
||||
server::start(fs, net).await;
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ pub fn init(fs: FileSystem) {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn start(fs: FileSystem, net: Network) {
|
||||
pub async fn start(fs: FileSystem, net: Network) {
|
||||
let Ok(_) = init_logging() else {
|
||||
eprintln!("Failed to initialize logging.");
|
||||
return;
|
||||
|
@ -49,17 +49,14 @@ pub fn start(fs: FileSystem, net: Network) {
|
|||
};
|
||||
|
||||
info!("Config loaded");
|
||||
let actors = config
|
||||
let addresses = config
|
||||
.forges()
|
||||
.flat_map(|(forge_name, forge)| create_forge_repos(forge, forge_name, &net))
|
||||
.map(start_actor)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
actix::System::new().block_on(async {
|
||||
let addresses = actors.into_iter().map(start_actor).collect::<Vec<_>>();
|
||||
let _ = actix_rt::signal::ctrl_c().await;
|
||||
info!("Ctrl-C received, shutting down...");
|
||||
drop(addresses);
|
||||
});
|
||||
}
|
||||
|
||||
fn create_forge_repos(
|
||||
|
|
Loading…
Reference in a new issue