Implemented a custom JS event loop and use call_function_immediate with custom completers to allow interleaving multiple requests into the same isolate.

This avoids idle while JS is doing I/O and avoid corner-case of livelock when running out of free workers while TB calls itself.
This commit is contained in:
Sebastian Jeltsch
2024-11-21 17:12:09 +01:00
parent 462ca2aacf
commit bc09fde7ab
4 changed files with 333 additions and 244 deletions

View File

@@ -20,7 +20,7 @@ async function initTrailBase(): Promise<{ subprocess: Subprocess }> {
throw Error("cargo build failed");
}
const subprocess = execa`cargo run -- --data-dir ../testfixture run -a 127.0.0.1:${port} --js-runtime-threads 2`;
const subprocess = execa`cargo run -- --data-dir ../testfixture run -a 127.0.0.1:${port} --js-runtime-threads 1`;
for (let i = 0; i < 100; ++i) {
if ((subprocess.exitCode ?? 0) > 0) {