keep web requests off rebuild path
This commit is contained in:
@@ -975,6 +975,13 @@ bool compiler_unit_compile_in_progress(Request* context, String file_name)
|
||||
return(false);
|
||||
}
|
||||
|
||||
bool compiler_request_can_serve_stale_artifact(Request* context)
|
||||
{
|
||||
return(context && context->server && !context->resources.is_cli &&
|
||||
to_bool(context->server->config["PROACTIVE_COMPILE_ENABLED"], true) &&
|
||||
float_val(context->server->config["PROACTIVE_COMPILE_CHECK_INTERVAL"]) > 0);
|
||||
}
|
||||
|
||||
void unit_render(String file_name)
|
||||
{
|
||||
unit_render(file_name, *context);
|
||||
|
||||
@@ -18,6 +18,7 @@ SharedUnit* get_shared_unit(Request* context, String file_name);
|
||||
String compiler_error_page_unit(Request* context, String config_key);
|
||||
bool compiler_unit_compile_pending(Request* context, String file_name);
|
||||
bool compiler_unit_compile_in_progress(Request* context, String file_name);
|
||||
bool compiler_request_can_serve_stale_artifact(Request* context);
|
||||
String compiler_site_directory(Request* context);
|
||||
StringList compiler_scan_site_units(Request* context);
|
||||
StringList compiler_list_known_units(Request* context);
|
||||
|
||||
@@ -100,7 +100,7 @@ static bool wasm_artifact_exists(Request* context, const String& entry_unit)
|
||||
// metadata mismatches, which can leave stale wasm with old imports.
|
||||
bool source_missing = false;
|
||||
if(compiler_unit_needs_recompile(context, entry_unit, &source_missing))
|
||||
return(compiler_unit_compile_in_progress(context, entry_unit));
|
||||
return(compiler_request_can_serve_stale_artifact(context) || compiler_unit_compile_in_progress(context, entry_unit));
|
||||
if(source_missing)
|
||||
return(false);
|
||||
return(true);
|
||||
|
||||
+1
-1
@@ -1606,7 +1606,7 @@ private:
|
||||
return(1);
|
||||
}
|
||||
|
||||
if(!file_exists_host(worker.unit_wasm_path(resolved)) || (compiler_unit_needs_recompile(context, resolved, 0) && !compiler_unit_compile_in_progress(context, resolved)))
|
||||
if(!file_exists_host(worker.unit_wasm_path(resolved)) || (compiler_unit_needs_recompile(context, resolved, 0) && !compiler_request_can_serve_stale_artifact(context) && !compiler_unit_compile_in_progress(context, resolved)))
|
||||
get_shared_unit(context, resolved);
|
||||
|
||||
size_t unit_index = 0;
|
||||
|
||||
Reference in New Issue
Block a user