Reintroduced graceful shutdown
ci/woodpecker/push/ociImagePush Pipeline is running Details

This commit is contained in:
Natty 2024-05-20 17:23:08 +02:00
parent e06906dd6e
commit b74f2d69a4
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
2 changed files with 2 additions and 3 deletions

View File

@ -122,12 +122,11 @@ async fn main() -> miette::Result<()> {
let listener = TcpListener::bind(addr).await.into_diagnostic()?; let listener = TcpListener::bind(addr).await.into_diagnostic()?;
tracing::info!("Serving..."); tracing::info!("Serving...");
axum::serve(listener, app.into_make_service()) axum::serve(listener, app.into_make_service())
.with_graceful_shutdown(shutdown_signal())
.await .await
.map_err(|e| miette!("Error running server: {}", e)) .map_err(|e| miette!("Error running server: {}", e))
} }
// FIXME: Plug this back in when Axum reimplements graceful shutdown
async fn shutdown_signal() { async fn shutdown_signal() {
let ctrl_c = async { let ctrl_c = async {
if let Err(e) = signal::ctrl_c().await { if let Err(e) = signal::ctrl_c().await {

View File

@ -93,11 +93,11 @@ async fn main() -> miette::Result<()> {
let listener = TcpListener::bind(addr).await.into_diagnostic()?; let listener = TcpListener::bind(addr).await.into_diagnostic()?;
info!("Serving..."); info!("Serving...");
axum::serve(listener, app.into_make_service()) axum::serve(listener, app.into_make_service())
.with_graceful_shutdown(shutdown_signal())
.await .await
.map_err(|e| miette!("Error running server: {}", e)) .map_err(|e| miette!("Error running server: {}", e))
} }
// FIXME: Plug this back in when Axum reimplements graceful shutdown
async fn shutdown_signal() { async fn shutdown_signal() {
let ctrl_c = async { let ctrl_c = async {
if let Err(e) = signal::ctrl_c().await { if let Err(e) = signal::ctrl_c().await {