From f0b01fc0ff8e8fdcc23cec87f5c55f29245b5a2f Mon Sep 17 00:00:00 2001 From: Jonathan Baecker Date: Sun, 6 Oct 2024 20:44:21 +0200 Subject: [PATCH] catch error, set is_processing to false on status --- Cargo.lock | 4 ++-- engine/Cargo.toml | 2 +- engine/src/api/routes.rs | 2 ++ frontend/components/ConfigPlayout.vue | 18 ++++++++++++------ 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ec4364b1..a43465a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3647,9 +3647,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.31.4" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "355dbe4f8799b304b05e1b0f05fc59b2a18d36645cf169607da45bde2f69a1be" +checksum = "e3b5ae3f4f7d64646c46c4cae4e3f01d1c5d255c7406fdd7c7f999a94e488791" dependencies = [ "core-foundation-sys", "libc", diff --git a/engine/Cargo.toml b/engine/Cargo.toml index 296ff9a4..68e32230 100644 --- a/engine/Cargo.toml +++ b/engine/Cargo.toml @@ -55,7 +55,7 @@ serde_json = "1.0" serde_with = "3.8" shlex = "1.1" static-files = "0.2" -sysinfo ={ version = "0.31", features = ["linux-netdevs", "linux-tmpfs"] } +sysinfo ={ version = "0.32", features = ["linux-netdevs", "linux-tmpfs"] } sqlx = { version = "0.8", features = ["runtime-tokio", "sqlite"] } time = { version = "0.3", features = ["formatting", "macros"] } tokio = { version = "1.29", features = ["full"] } diff --git a/engine/src/api/routes.rs b/engine/src/api/routes.rs index a6f60362..0780067f 100644 --- a/engine/src/api/routes.rs +++ b/engine/src/api/routes.rs @@ -956,6 +956,8 @@ pub async fn process_control( match proc.into_inner().command { ProcessCtl::Status => { + manager.is_processing.store(false, Ordering::SeqCst); + if manager.is_alive.load(Ordering::SeqCst) { return Ok(web::Json("active")); } else { diff --git a/frontend/components/ConfigPlayout.vue b/frontend/components/ConfigPlayout.vue index 6e39c000..e56a3b09 100644 --- a/frontend/components/ConfigPlayout.vue +++ b/frontend/components/ConfigPlayout.vue @@ -183,13 +183,17 @@ async function onSubmitPlayout() { method: 'POST', headers: { ...configStore.contentType, ...authStore.authHeader }, body: JSON.stringify({ command: 'status' }), - }).then(async (response: any) => { - if (response === 'active') { - showModal.value = true - } - - await configStore.getPlayoutConfig() }) + .then(async (response: any) => { + if (response === 'active') { + showModal.value = true + } + + await configStore.getPlayoutConfig() + }) + .catch((e) => { + indexStore.msgAlert('error', e.data, 3) + }) } else { indexStore.msgAlert('error', t('config.updatePlayoutFailed'), 2) } @@ -203,6 +207,8 @@ async function restart(res: boolean) { method: 'POST', headers: { ...configStore.contentType, ...authStore.authHeader }, body: JSON.stringify({ command: 'restart' }), + }).catch((e) => { + indexStore.msgAlert('error', e.data, 3) }) }