23 lines
681 B
Rust
23 lines
681 B
Rust
use zero2prod::{
|
|
configuration::get_configuration, issue_delivery_worker::run_worker_until_stopped,
|
|
startup::Application, telemetry::init_subscriber,
|
|
};
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), anyhow::Error> {
|
|
init_subscriber(std::io::stdout);
|
|
|
|
let configuration = get_configuration().expect("Failed to read configuration");
|
|
let application = Application::build(configuration.clone()).await?;
|
|
|
|
let application_task = tokio::spawn(application.run_until_stopped());
|
|
let worker_task = tokio::spawn(run_worker_until_stopped(configuration));
|
|
|
|
tokio::select! {
|
|
_ = application_task => {},
|
|
_ = worker_task => {},
|
|
};
|
|
|
|
Ok(())
|
|
}
|