- update: moved signal handler into utils crate to make it easier to update
- fix: windows compile issue due to exposed unix signal
This commit is contained in:
@@ -50,16 +50,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let db_address = db_nodes.get(0).unwrap();
|
||||
let db_url = format!("http://{}:{}", db_address.ServiceAddress, db_address.ServicePort);
|
||||
|
||||
let mut sigterm_stream = signal::unix::signal(signal::unix::SignalKind::terminate())?;
|
||||
select! {
|
||||
_ = signal::ctrl_c() => {
|
||||
info!("Received SIGINT (Ctrl+C), shutting down...");
|
||||
},
|
||||
_ = sigterm_stream.recv() => {
|
||||
info!("Received SIGTERM, shutting down...");
|
||||
},
|
||||
}
|
||||
|
||||
utils::signal_handler::wait_for_signal().await;
|
||||
consul_registration::deregister_service(&consul_url, service_id.as_str()).await.expect("");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user