fix cancel jobs

This commit is contained in:
Ruben Fiszel
2023-08-27 15:09:54 +02:00
parent e051451cd6
commit 38f4e7f69d
3 changed files with 16 additions and 7 deletions

View File

@@ -10,6 +10,13 @@ use ::tracing::{field, Span};
use hyper::Response;
use tower_http::trace::{MakeSpan, OnFailure, OnResponse};
lazy_static::lazy_static! {
static ref LOG_REQUESTS: bool = std::env::var("LOG_REQUESTS")
.ok()
.and_then(|x| x.parse::<bool>().ok())
.unwrap_or(true);
}
#[derive(Clone)]
pub struct MyOnResponse {}
@@ -20,11 +27,13 @@ impl<B> OnResponse<B> for MyOnResponse {
latency: std::time::Duration,
_span: &tracing::Span,
) {
tracing::info!(
latency = latency.as_millis(),
status = response.status().as_u16(),
"response"
)
if *LOG_REQUESTS {
tracing::info!(
latency = latency.as_millis(),
status = response.status().as_u16(),
"response"
)
}
}
}

View File

@@ -141,7 +141,7 @@ pub async fn cancel_job<'c: 'async_recursion>(
}
let job_running = job_running.unwrap();
if ((!job_running.running && job_running.root_job.is_none())
if ((job_running.running || job_running.root_job.is_some())
|| (job_running.job_kind == JobKind::Flow || job_running.job_kind == JobKind::FlowPreview))
&& !force_cancel
{

View File

@@ -194,7 +194,7 @@
<PageHeader title="Home">
<div class="flex flex-row gap-4 flex-wrap justify-end items-center">
{#if !$userStore?.operator}
<span class="text-sm text-secondary">Create a new:</span>
<span class="text-sm text-secondary">Create a</span>
<CreateActionsScript />
{#if HOME_SHOW_CREATE_FLOW}<CreateActionsFlow />{/if}
{#if HOME_SHOW_CREATE_APP}<CreateActionsApp />{/if}