From 9dc9c61af6b24f66ba9d44aef9d5097607c0ebcd Mon Sep 17 00:00:00 2001 From: udo Date: Thu, 16 Jul 2026 16:06:02 +0000 Subject: [PATCH] Keep proactive freshness scans off requests --- src/wasm/worker.cpp | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/src/wasm/worker.cpp b/src/wasm/worker.cpp index 0dadf25..c3e086a 100644 --- a/src/wasm/worker.cpp +++ b/src/wasm/worker.cpp @@ -645,22 +645,6 @@ public: return(cfg.cache_root + source_path + ".wasm"); } - bool component_unit_needs_recompile(Request* context, const String& source_path, bool can_serve_stale) - { - if(!can_serve_stale) - return(compiler_unit_needs_recompile(context, source_path, 0)); - // The proactive compiler owns stale HTTP publication. Bound its full - // source-graph signature scan per worker instead of repeating it at every - // component boundary; CLI and non-stale requests keep immediate checks. - auto now = std::chrono::steady_clock::now(); - auto cached = component_freshness.find(source_path); - if(cached != component_freshness.end() && now - cached->second.first < std::chrono::seconds(1)) - return(cached->second.second); - bool stale = compiler_unit_needs_recompile(context, source_path, 0); - component_freshness[source_path] = {now, stale}; - return(stale); - } - std::shared_ptr unit_module(const String& source_path, String& error) { String wasm_path = unit_wasm_path(source_path); @@ -789,7 +773,6 @@ private: } std::map> module_cache; - std::map> component_freshness; }; // ---- workspace (per request) ---------------------------------------------- @@ -1638,11 +1621,13 @@ private: return(1); } + bool artifact_exists = file_exists_host(worker.unit_wasm_path(resolved)); bool can_serve_stale = compiler_request_can_serve_stale_artifact(context); - bool stale = worker.component_unit_needs_recompile(context, resolved, can_serve_stale); - if(stale && can_serve_stale) - compiler_prioritize_unit(context, resolved); - if(!file_exists_host(worker.unit_wasm_path(resolved)) || (stale && !can_serve_stale)) + // The proactive compiler owns freshness while stale HTTP artifacts may be + // served. Keep source-graph scans off that request path; CLI/non-stale + // execution still checks synchronously and cold artifacts still compile. + bool stale = !can_serve_stale && artifact_exists && compiler_unit_needs_recompile(context, resolved, 0); + if(!artifact_exists || stale) get_shared_unit(context, resolved); size_t unit_index = 0;