fix: added MAX_CONCURRENCY limit as each webworker costs RAM, and machines with e.g 24 cores crash the process (#2161)

This commit is contained in:
matthiasg 2020-11-30 13:17:27 +01:00 committed by GitHub
parent 5121913ee6
commit d2e777bafc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,9 +2,11 @@ import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';
let initialized = false;
const MAX_CONCURRENCY = 6;
export default function initWebWorkers() {
const config = {
maxWebWorkers: Math.max(navigator.hardwareConcurrency - 1, 1),
maxWebWorkers: Math.max(Math.min(navigator.hardwareConcurrency - 1, MAX_CONCURRENCY), 1),
startWebWorkersOnDemand: true,
taskConfiguration: {
decodeTask: {