Prewarm wasm workers before accepting requests
This commit is contained in:
@@ -1388,6 +1388,15 @@ void listen_for_connections()
|
||||
server.on_data = &handle_data;
|
||||
server.on_complete = &handle_complete;
|
||||
server.on_cli_complete = &handle_cli_complete;
|
||||
Request startup_context;
|
||||
startup_context.server = &server_state;
|
||||
f64 wasm_start = time_precise();
|
||||
String wasm_error = wasm_backend_start(startup_context);
|
||||
f64 wasm_ms = (time_precise() - wasm_start) * 1000.0;
|
||||
if(wasm_error == "")
|
||||
printf("(P) wasm worker ready: PID %i in %.3f ms\n", getpid(), wasm_ms);
|
||||
else
|
||||
fprintf(stderr, "(!) wasm worker initialization failed: PID %i in %.3f ms: %s\n", getpid(), wasm_ms, wasm_error.c_str());
|
||||
for(;;)
|
||||
{
|
||||
server.process(-1);
|
||||
|
||||
Reference in New Issue
Block a user