mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-11-22 06:47:56 +01:00
Properly start api server
This commit is contained in:
parent
2fbef020a3
commit
be73385758
18
src/main.rs
18
src/main.rs
@ -168,15 +168,17 @@ fn maybe(matches: clap::ArgMatches, log: Arc<Logger>) -> Result<(), Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let (signal, shutdown) = async_channel::bounded::<()>(1);
|
let (signal, shutdown) = async_channel::bounded::<()>(1);
|
||||||
easy_parallel::Parallel::new()
|
let (_, r) = easy_parallel::Parallel::new()
|
||||||
.each(0..4, |_| smol::block_on(ex.run(shutdown.recv())))
|
.each(0..4, |_| smol::block_on(ex.run(shutdown.recv())))
|
||||||
.run();
|
.finish(|| {
|
||||||
|
let db = db::Databases::new(&log, &config)?;
|
||||||
|
// TODO: Spawn api connections on their own (non-main) thread, use the main thread to
|
||||||
|
// handle signals (a cli if stdin is not closed?) and make it stop and clean up all threads
|
||||||
|
// when bffh should exit
|
||||||
|
server::serve_api_connections(log.clone(), config, db, network)
|
||||||
|
// Signal is dropped here, stopping all executor threads as well.
|
||||||
|
});
|
||||||
|
|
||||||
let db = db::Databases::new(&log, &config)?;
|
return r;
|
||||||
// TODO: Spawn api connections on their own (non-main) thread, use the main thread to
|
|
||||||
// handle signals (a cli if stdin is not closed?) and make it stop and clean up all threads
|
|
||||||
// when bffh should exit
|
|
||||||
server::serve_api_connections(log.clone(), config, db, network)
|
|
||||||
// Signal is dropped here, stopping all executor threads as well.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user