Update server.js
Browse files
server.js
CHANGED
|
@@ -171,7 +171,8 @@ app.post('/render', async (req, res) => {
|
|
| 171 |
// --------------------------------------
|
| 172 |
// SEGMENTED BATCH RENDERING
|
| 173 |
// --------------------------------------
|
| 174 |
-
|
|
|
|
| 175 |
const totalBatches = Math.ceil(httpScenes.length / BATCH_SIZE);
|
| 176 |
const partFiles = [];
|
| 177 |
|
|
@@ -209,7 +210,7 @@ app.post('/render', async (req, res) => {
|
|
| 209 |
inputProps: { scenes: batchScenes, settings },
|
| 210 |
chromiumOptions: {
|
| 211 |
executablePath: process.env.CHROME_BIN || '/usr/bin/google-chrome-stable',
|
| 212 |
-
enableMultiProcessRendering:
|
| 213 |
args: [
|
| 214 |
'--no-sandbox',
|
| 215 |
'--disable-dev-shm-usage',
|
|
@@ -219,8 +220,8 @@ app.post('/render', async (req, res) => {
|
|
| 219 |
'--ignore-gpu-blocklist',
|
| 220 |
]
|
| 221 |
},
|
| 222 |
-
concurrency:
|
| 223 |
-
disallowParallelEncoding:
|
| 224 |
onProgress: ({ progress }) => {
|
| 225 |
const percent = Math.round(progress * 100);
|
| 226 |
if (percent !== lastLoggedPercent && percent % 10 === 0) {
|
|
|
|
| 171 |
// --------------------------------------
|
| 172 |
// SEGMENTED BATCH RENDERING
|
| 173 |
// --------------------------------------
|
| 174 |
+
// CRASH FIX: Reduce batch size to 10 to prevent OOM
|
| 175 |
+
const BATCH_SIZE = 10;
|
| 176 |
const totalBatches = Math.ceil(httpScenes.length / BATCH_SIZE);
|
| 177 |
const partFiles = [];
|
| 178 |
|
|
|
|
| 210 |
inputProps: { scenes: batchScenes, settings },
|
| 211 |
chromiumOptions: {
|
| 212 |
executablePath: process.env.CHROME_BIN || '/usr/bin/google-chrome-stable',
|
| 213 |
+
enableMultiProcessRendering: false, // STABILITY: Single process saves RAM
|
| 214 |
args: [
|
| 215 |
'--no-sandbox',
|
| 216 |
'--disable-dev-shm-usage',
|
|
|
|
| 220 |
'--ignore-gpu-blocklist',
|
| 221 |
]
|
| 222 |
},
|
| 223 |
+
concurrency: 1, // STABILITY: Render one frame at a time
|
| 224 |
+
disallowParallelEncoding: true, // STABILITY: Reduce encoding memory pressure
|
| 225 |
onProgress: ({ progress }) => {
|
| 226 |
const percent = Math.round(progress * 100);
|
| 227 |
if (percent !== lastLoggedPercent && percent % 10 === 0) {
|