2023-01-13 02:51:32 -05:00
|
|
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
|
|
|
2022-09-28 13:46:29 -04:00
|
|
|
if (Deno.build.os !== "linux") {
|
|
|
|
throw new Error("SO_REUSEPORT is only supported on Linux");
|
|
|
|
}
|
|
|
|
|
|
|
|
const executable = Deno.execPath();
|
|
|
|
const path = new URL("./deno_http_flash.js", import.meta.url).pathname;
|
|
|
|
// single flash instance runs on ~1.8 cores
|
|
|
|
const cpus = navigator.hardwareConcurrency / 2;
|
|
|
|
const processes = new Array(cpus);
|
|
|
|
for (let i = 0; i < cpus; i++) {
|
2023-02-09 22:00:23 -05:00
|
|
|
// deno-lint-ignore no-deprecated-deno-api
|
2022-09-28 13:46:29 -04:00
|
|
|
const proc = Deno.run({
|
|
|
|
cmd: [executable, "run", "-A", "--unstable", path, Deno.args[0]],
|
|
|
|
});
|
|
|
|
processes.push(proc.status());
|
|
|
|
}
|
|
|
|
await Promise.all(processes);
|