- fix: when shutting down a docker container, the services would not deregister from consul correctly
This commit is contained in:
@@ -67,8 +67,14 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
info!("Starting REST API on {}:{}", addr, port);
|
||||
tokio::spawn(axum_gateway::serve_rest_api(grpc_client));
|
||||
|
||||
let mut sigterm_stream = signal::unix::signal(signal::unix::SignalKind::terminate())?;
|
||||
select! {
|
||||
_ = signal::ctrl_c() => {},
|
||||
_ = signal::ctrl_c() => {
|
||||
info!("Received SIGINT (Ctrl+C), shutting down...");
|
||||
},
|
||||
_ = sigterm_stream.recv() => {
|
||||
info!("Received SIGTERM, shutting down...");
|
||||
},
|
||||
}
|
||||
|
||||
consul_registration::deregister_service(&consul_url, service_id.as_str())
|
||||
|
||||
Reference in New Issue
Block a user