拆分unzip工作进程

This commit is contained in:
undefined committed 2020-06-18 22:58:39 +08:00
1 parent d040b153a1
commit b54c22cb84
5 files changed
+142 -11

No files matched your search

-2
View File
@@ -21,11 +21,9 @@ async function load(call) {
ensureDir(path.resolve(os.tmpdir(), 'hydro'));
ensureDir(path.resolve(os.tmpdir(), 'hydro', 'tmp'));
ensureDir(path.resolve(os.tmpdir(), 'hydro', 'public'));
// TODO better run in another process as this needs lots of memory
await call({ entry: 'unzip', newProcess: true });
let pending = await require('../lib/hpm').getInstalled();
const fail = [];
const active = [];
require('../lib/i18n');
require('../utils');
require('../error');
+7
View File
@@ -31,6 +31,10 @@ for (const i of moduleRoots) {
}
}
async function load() {
process.on('unhandledRejection', (e) => {
console.error(e);
process.exit(1);
});
const files = fs.readdirSync(moduleRoot);
const t = ['service', 'lib', 'model', 'handler', 'script'];
ensureDir(`${os.tmpdir()}/hydro`);
@@ -115,6 +119,9 @@ async function load() {
}
}
}
setTimeout(() => {
process.exit(0);
}, 0);
}
module.exports = load;