mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 11:26:02 +00:00
fix(engine): use static import for os.totalmem in ESM config
Replace dynamic require("os") with static import — require is undefined
in native ESM, causing the try/catch to silently return the 16GB
fallback on every machine. The cache scaling was dead code.
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
* fallbacks for backward compatibility during migration.
|
||||
*/
|
||||
|
||||
import { totalmem } from "os";
|
||||
|
||||
/**
|
||||
* Full engine configuration. All fields are wired through the config
|
||||
* object; env vars serve as backward-compatible fallbacks resolved
|
||||
@@ -209,11 +211,7 @@ export const DEFAULT_CONFIG: EngineConfig = {
|
||||
};
|
||||
|
||||
function getSystemTotalMb(): number {
|
||||
try {
|
||||
return Math.floor(require("os").totalmem() / (1024 * 1024));
|
||||
} catch {
|
||||
return 16384;
|
||||
}
|
||||
return Math.floor(totalmem() / (1024 * 1024));
|
||||
}
|
||||
|
||||
function memoryAdaptiveCacheLimit(): number {
|
||||
|
||||
Reference in New Issue
Block a user