diff --git a/Cargo.lock b/Cargo.lock index 3d996cfa..989ab908 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2298,7 +2298,7 @@ dependencies = [ [[package]] name = "omnect-device-service" -version = "0.41.15" +version = "0.41.16" dependencies = [ "actix-server", "actix-web", diff --git a/Cargo.toml b/Cargo.toml index 0254f29f..847f08d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" name = "omnect-device-service" readme = "README.md" repository = "https://github.com/omnect/omnect-device-service.git" -version = "0.41.15" +version = "0.41.16" [dependencies] actix-server = { version = "2.6", default-features = false } diff --git a/src/web_service.rs b/src/web_service.rs index 9f688b52..20cde236 100644 --- a/src/web_service.rs +++ b/src/web_service.rs @@ -23,6 +23,7 @@ use tokio::{ time::Duration, }; +static SHUTDWOWN_TIMEOUT_SECS: u64 = 10; static IS_WEBSERVICE_DISABLED: OnceLock = OnceLock::new(); static PUBLISH_CHANNEL_MAP: LazyLock>> = LazyLock::new(|| Mutex::new(serde_json::Map::default())); @@ -188,7 +189,10 @@ impl WebService { .context("web_service: cannot listen on UnixListener")? }; - let srv = srv.run(); + let srv = srv + .disable_signals() + .shutdown_timeout(SHUTDWOWN_TIMEOUT_SECS) + .run(); let srv_handle = srv.handle();