(workerPath)
| 24 | ); |
| 25 | const PREVIEW_3MF_WORKER_MEMORY_MB = Math.max( |
| 26 | 512, |
| 27 | Number.parseInt(process.env.PRINTVENTORY_PREVIEW_3MF_WORKER_MEMORY_MB || '2048', 10) || 2048 |
| 28 | ); |
| 29 | const PREVIEW_3MF_MAX_DISK_CACHE_MB = Math.max( |
| 30 | 50, |
| 31 | Number.parseInt(process.env.PRINTVENTORY_PREVIEW_3MF_MAX_DISK_CACHE_MB || '150', 10) || 150 |
| 32 | ); |
| 33 | |
| 34 | function getPreview3mfCacheDir() { |
| 35 | return path.join(app.getPath('userData'), '3mf-preview-cache'); |
| 36 | } |
| 37 | |
| 38 | function createPreview3mfWorker(workerPath) { |
| 39 | return new Worker(workerPath, { |
| 40 | resourceLimits: { |
| 41 | maxOldGenerationSizeMb: PREVIEW_3MF_WORKER_MEMORY_MB, |
| 42 | maxYoungGenerationSizeMb: Math.min(256, Math.floor(PREVIEW_3MF_WORKER_MEMORY_MB / 4)) |
| 43 | } |
| 44 | }); |
| 45 | } |
no outgoing calls
no test coverage detected