Stylique commited on
Commit
0a900e7
·
verified ·
1 Parent(s): 885352b

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +5 -4
server.js CHANGED
@@ -171,7 +171,8 @@ app.post('/render', async (req, res) => {
171
  // --------------------------------------
172
  // SEGMENTED BATCH RENDERING
173
  // --------------------------------------
174
- const BATCH_SIZE = 40; // Render 40 scenes at a time
 
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: true,
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: 4,
223
- disallowParallelEncoding: false,
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) {