feat(writer): Increase UV_THREADPOOL_SIZE

This increases the UV_THREADPOOL_SIZE to CPUs * 4 to
facilitate full write speeds when writing to multiple destinations,
in preparation for integrating multi-writes.

Change-Type: patch
Changelog-Entry: Increase UV_THREADPOOL_SIZE to allocate 4 threads per CPU
This commit is contained in:
Jonas Hermsmeier 2018-01-19 16:11:09 +01:00
parent c3600ee8fc
commit fbb175608d
No known key found for this signature in database
GPG Key ID: 1B870F801A0CEE9F

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')),