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 authored and GitHub committed 2020-11-30 13:17:27 +01:00
1 parent 5121913ee6
commit d2e777bafc
1 file changed
+3 -1
+3 -1
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: {