Skip to content

Official Codebase of 3DCodeVerse

Python

runtime_js: C3D_BROWSER_REUSE reads the Settings words, a garbage C3D_PAGE_TTL_MS keeps the default

gaoypeng3d278843721a
diff --git a/harness/runtime_js/browser_daemon.cjs b/harness/runtime_js/browser_daemon.cjs
index a8dba3b6..6a273149 100644
--- a/harness/runtime_js/browser_daemon.cjs
+++ b/harness/runtime_js/browser_daemon.cjs
@@ -21,7 +21,8 @@ const POLL_MS = 15 * 1000;
// A page older than this belongs to nobody: every harness render/probe finishes or
// times out well under it (ceilings <= 330 s), and a SIGKILLed client never closes
// its page. Leaked pages hold WebGL contexts that eventually wedge the browser.
-const PAGE_TTL_MS = Number(process.env.C3D_PAGE_TTL_MS || 8 * 60 * 1000);
+// a value that is not a positive number keeps the default (NaN would never reap a page)
+const PAGE_TTL_MS = Number(process.env.C3D_PAGE_TTL_MS) > 0 ? Number(process.env.C3D_PAGE_TTL_MS) : 8 * 60 * 1000;
function arg(name, dflt) {
const i = process.argv.indexOf(`--${name}`);
diff --git a/harness/runtime_js/gpu_launch.cjs b/harness/runtime_js/gpu_launch.cjs
index 0118e7af..e85e4fe4 100644
--- a/harness/runtime_js/gpu_launch.cjs
+++ b/harness/runtime_js/gpu_launch.cjs
@@ -155,7 +155,8 @@ function spawnLockPath(backend) {
}
function reuseEnabled() {
- return !/^(off|0|false)$/i.test(process.env.C3D_BROWSER_REUSE || '');
+ // the Settings Flag words (codeverse3d/config.py): off/0/false/no turn it off
+ return !/^\s*(off|0|false|no)\s*$/i.test(process.env.C3D_BROWSER_REUSE || '');
}
function readJson(p) {