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:
parent
5121913ee6
commit
d2e777bafc
@ -2,9 +2,11 @@ import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';
|
|||||||
|
|
||||||
let initialized = false;
|
let initialized = false;
|
||||||
|
|
||||||
|
const MAX_CONCURRENCY = 6;
|
||||||
|
|
||||||
export default function initWebWorkers() {
|
export default function initWebWorkers() {
|
||||||
const config = {
|
const config = {
|
||||||
maxWebWorkers: Math.max(navigator.hardwareConcurrency - 1, 1),
|
maxWebWorkers: Math.max(Math.min(navigator.hardwareConcurrency - 1, MAX_CONCURRENCY), 1),
|
||||||
startWebWorkersOnDemand: true,
|
startWebWorkersOnDemand: true,
|
||||||
taskConfiguration: {
|
taskConfiguration: {
|
||||||
decodeTask: {
|
decodeTask: {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user