Reintroduced graceful shutdown
ci/woodpecker/push/ociImagePush Pipeline is running
Details
ci/woodpecker/push/ociImagePush Pipeline is running
Details
This commit is contained in:
parent
e06906dd6e
commit
b74f2d69a4
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue