Avoid repeated warm request dispatch work

This commit is contained in:
udo
2026-07-18 02:32:28 +00:00
parent 72fd0dd53a
commit 339031b6c3
4 changed files with 26 additions and 5 deletions
+9 -4
View File
@@ -439,9 +439,13 @@ int handle_cli_complete(FastCGIRequest& request)
// been removed, so a unit that still cannot be served by wasm is a
// request failure instead of a fallback path.
SharedUnit* cli_compile_state = 0;
if(!wasm_backend_should_handle(request, cli_unit))
bool cli_wasm_ready = wasm_backend_should_handle(request, cli_unit);
if(!cli_wasm_ready)
{
cli_compile_state = get_shared_unit(&request, cli_unit);
if(wasm_backend_should_handle(request, cli_unit))
cli_wasm_ready = wasm_backend_should_handle(request, cli_unit);
}
if(cli_wasm_ready)
{
String wasm_error = wasm_backend_serve(request, cli_unit, "cli");
if(wasm_error != "")
@@ -596,8 +600,9 @@ int handle_complete(FastCGIRequest& request) {
// be served by wasm becomes a clean 500 request failure.
SharedUnit* entry_compile_state = 0;
auto wasm_ready = [&](const String& unit) -> bool {
if(!wasm_backend_should_handle(request, unit))
entry_compile_state = get_shared_unit(&request, unit);
if(wasm_backend_should_handle(request, unit))
return(true);
entry_compile_state = get_shared_unit(&request, unit);
return(wasm_backend_should_handle(request, unit));
};
auto fail_wasm_unavailable = [&](const String& handler) {