Limit concurrency during plugin compilation
Summary: My MBP just crashed again during startup. I would like to understand why every plugin compilation appears to start up a new electron process, but until that's understood and hopefully fixed, it's probably best to limit the number of processes we spawn by setting an upper bound here. N.B. My Linux box doesn't mind this at all. Reviewed By: jknoxville, danielbuechele Differential Revision: D17419289 fbshipit-source-id: a11562a21a984059dc35e826eb20d869df218546
This commit is contained in:
committed by
Facebook Github Bot
parent
ada2327520
commit
2a6462641b
@@ -12,6 +12,7 @@ const Metro = require('metro');
|
||||
const util = require('util');
|
||||
const recursiveReaddir = require('recursive-readdir');
|
||||
const expandTilde = require('expand-tilde');
|
||||
const pMap = require('p-map');
|
||||
const HOME_DIR = require('os').homedir();
|
||||
|
||||
/* eslint-disable prettier/prettier */
|
||||
@@ -38,12 +39,12 @@ module.exports = async (
|
||||
fs.mkdirSync(pluginCache);
|
||||
}
|
||||
watchChanges(plugins, reloadCallback, pluginCache, options);
|
||||
const compilations = Object.values(plugins).map(plugin => {
|
||||
const compilations = pMap(Object.values(plugins), plugin => {
|
||||
const dynamicOptions = Object.assign(options, {force: false});
|
||||
return compilePlugin(plugin, pluginCache, dynamicOptions);
|
||||
});
|
||||
}, {concurrency: 4});
|
||||
|
||||
const dynamicPlugins = (await Promise.all(compilations)).filter(c => c != null);
|
||||
const dynamicPlugins = (await compilations).filter(c => c != null);
|
||||
console.log('✅ Compiled all plugins.');
|
||||
return dynamicPlugins;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user