Merge pull request #2039 from resin-io/uv-threadpool-size

feat(writer): Increase UV_THREADPOOL_SIZE
This commit is contained in:
Jonas Hermsmeier 2018-02-13 10:55:07 -08:00 committed by GitHub
commit de4f9e4257
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,6 +31,13 @@ const windowProgress = require('../os/window-progress')
const analytics = require('../modules/analytics')
const packageJSON = require('../../../../package.json')
/**
* @summary Number of threads per CPU to allocate to the UV_THREADPOOL
* @type {Number}
* @constant
*/
const THREADS_PER_CPU = 4
/**
* @summary Get application entry point
* @function
@ -165,6 +172,7 @@ exports.performWrite = (image, drive, onProgress) => {
IPC_CLIENT_ID,
IPC_SOCKET_ROOT: ipc.config.socketRoot,
ELECTRON_RUN_AS_NODE: 1,
UV_THREADPOOL_SIZE: os.cpus().length * THREADS_PER_CPU,
// Casting to Number nicely converts booleans to 0 or 1.
OPTION_VALIDATE: Number(settings.get('validateWriteOnSuccess')),