From 18bb982852ad8e653a02acfd21108a236a478d6f Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Mon, 19 Feb 2024 23:38:27 +0100 Subject: [PATCH] feat: add support for mem peak to nativets scripts --- backend/windmill-worker/src/js_eval.rs | 6 ++++-- frontend/src/lib/components/DisplayResult.svelte | 2 +- frontend/src/lib/components/StringTypeNarrowing.svelte | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/windmill-worker/src/js_eval.rs b/backend/windmill-worker/src/js_eval.rs index 75cb8b6332..d89dc9c639 100644 --- a/backend/windmill-worker/src/js_eval.rs +++ b/backend/windmill-worker/src/js_eval.rs @@ -702,7 +702,7 @@ pub async fn eval_fetch_timeout( }) }); - run_future_with_polling_update_job_poller( + let r = run_future_with_polling_update_job_poller( job_id, job_timeout, db, @@ -718,7 +718,9 @@ pub async fn eval_fetch_timeout( isolate.terminate_execution(); } e - }) + })?; + *mem_peak = (r.0.get().len() / 1000) as i32; + Ok(r) } async fn eval_fetch(js_runtime: &mut JsRuntime, expr: &str) -> anyhow::Result> { diff --git a/frontend/src/lib/components/DisplayResult.svelte b/frontend/src/lib/components/DisplayResult.svelte index 369b65fbe1..7b068cdf2b 100644 --- a/frontend/src/lib/components/DisplayResult.svelte +++ b/frontend/src/lib/components/DisplayResult.svelte @@ -495,7 +495,7 @@ We recommend using persistent storage for large data files. For large files, we recommend using the S3 Object type instead of the base64 string type.