@nexrender/core 1.49.0 → 1.49.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/index.js +3 -0
- package/src/tasks/render.js +22 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexrender/core",
|
|
3
|
-
"version": "1.49.
|
|
3
|
+
"version": "1.49.1",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"author": "Inlife",
|
|
6
6
|
"homepage": "https://www.nexrender.com",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "86d7305136005f777e14a7ce538b0dd930946536"
|
|
42
42
|
}
|
package/src/index.js
CHANGED
|
@@ -91,6 +91,9 @@ const init = (settings) => {
|
|
|
91
91
|
|
|
92
92
|
onInstanceSpawn: undefined,
|
|
93
93
|
|
|
94
|
+
// amount of seconds before job will be marked as "stuck"
|
|
95
|
+
maxUpdateTimeout: process.env.NEXRENDER_MAX_UPDATE_TIMEOUT || 60,
|
|
96
|
+
|
|
94
97
|
__initialized: true,
|
|
95
98
|
}, settings, {
|
|
96
99
|
binary: binaryUser || binaryAuto,
|
package/src/tasks/render.js
CHANGED
|
@@ -186,6 +186,19 @@ Estimated date of change to the new behavior: 2023-06-01.\n`);
|
|
|
186
186
|
renderStopwatch = Date.now();
|
|
187
187
|
|
|
188
188
|
let timeoutID = 0;
|
|
189
|
+
let updateTimeout = 0;
|
|
190
|
+
|
|
191
|
+
const updateTimeoutInterval = setInterval(() => {
|
|
192
|
+
if (projectStart === null) return;
|
|
193
|
+
|
|
194
|
+
const now = Date.now()
|
|
195
|
+
if (now - updateTimeout > settings.maxUpdateTimeout * 1000) {
|
|
196
|
+
clearInterval(updateTimeoutInterval);
|
|
197
|
+
clearTimeout(timeoutID);
|
|
198
|
+
settings.trackSync('Job Render Failed', { job_id: job.uid, error: 'aerender_no_update' });
|
|
199
|
+
reject(new Error(`No update from aerender for ${settings.maxUpdateTimeout} seconds`));
|
|
200
|
+
}
|
|
201
|
+
}, 5000)
|
|
189
202
|
|
|
190
203
|
if (settings.debug) {
|
|
191
204
|
settings.logger.log(`[${job.uid}] spawning aerender process: ${settings.binary} ${params.join(' ')}`);
|
|
@@ -201,6 +214,7 @@ Estimated date of change to the new behavior: 2023-06-01.\n`);
|
|
|
201
214
|
|
|
202
215
|
instance.on('error', err => {
|
|
203
216
|
clearTimeout(timeoutID);
|
|
217
|
+
clearInterval(updateTimeoutInterval);
|
|
204
218
|
settings.trackSync('Job Render Failed', { job_id: job.uid, error: 'aerender_spawn_error' });
|
|
205
219
|
return reject(new Error(`Error starting aerender process: ${err}`));
|
|
206
220
|
});
|
|
@@ -208,17 +222,21 @@ Estimated date of change to the new behavior: 2023-06-01.\n`);
|
|
|
208
222
|
instance.stdout.on('data', (data) => {
|
|
209
223
|
output.push(parse(data.toString('utf8')));
|
|
210
224
|
(settings.verbose && settings.logger.log(data.toString('utf8')));
|
|
225
|
+
updateTimeout = Date.now()
|
|
211
226
|
});
|
|
212
227
|
|
|
213
228
|
instance.stderr.on('data', (data) => {
|
|
214
229
|
output.push(data.toString('utf8'));
|
|
215
230
|
(settings.verbose && settings.logger.log(data.toString('utf8')));
|
|
231
|
+
updateTimeout = Date.now()
|
|
216
232
|
});
|
|
217
233
|
|
|
218
234
|
if (settings.maxRenderTimeout && settings.maxRenderTimeout > 0) {
|
|
219
235
|
const timeout = 1000 * settings.maxRenderTimeout;
|
|
220
236
|
timeoutID = setTimeout(
|
|
221
237
|
() => {
|
|
238
|
+
clearInterval(updateTimeoutInterval);
|
|
239
|
+
clearTimeout(timeoutID);
|
|
222
240
|
settings.trackSync('Job Render Failed', { job_id: job.uid, error: 'aerender_timeout' });
|
|
223
241
|
reject(new Error(`Maximum rendering time exceeded`));
|
|
224
242
|
instance.kill('SIGINT');
|
|
@@ -245,6 +263,7 @@ Estimated date of change to the new behavior: 2023-06-01.\n`);
|
|
|
245
263
|
error: 'aerender_exit_code',
|
|
246
264
|
});
|
|
247
265
|
|
|
266
|
+
clearInterval(updateTimeoutInterval);
|
|
248
267
|
clearTimeout(timeoutID);
|
|
249
268
|
return reject(new Error(outputStr || 'aerender.exe failed to render the output into the file due to an unknown reason'));
|
|
250
269
|
}
|
|
@@ -263,6 +282,7 @@ Estimated date of change to the new behavior: 2023-06-01.\n`);
|
|
|
263
282
|
job_render_time: renderTime,
|
|
264
283
|
})
|
|
265
284
|
|
|
285
|
+
clearInterval(updateTimeoutInterval);
|
|
266
286
|
clearTimeout(timeoutID);
|
|
267
287
|
return resolve(job)
|
|
268
288
|
}
|
|
@@ -292,6 +312,7 @@ Estimated date of change to the new behavior: 2023-06-01.\n`);
|
|
|
292
312
|
|
|
293
313
|
settings.trackSync('Job Render Failed', { job_id: job.uid, error: 'aerender_output_not_found' });
|
|
294
314
|
clearTimeout(timeoutID);
|
|
315
|
+
clearInterval(updateTimeoutInterval);
|
|
295
316
|
return reject(new Error(`Couldn't find a result file: ${outputFile}`))
|
|
296
317
|
}
|
|
297
318
|
|
|
@@ -310,6 +331,7 @@ Estimated date of change to the new behavior: 2023-06-01.\n`);
|
|
|
310
331
|
});
|
|
311
332
|
|
|
312
333
|
clearTimeout(timeoutID);
|
|
334
|
+
clearInterval(updateTimeoutInterval);
|
|
313
335
|
resolve(job)
|
|
314
336
|
});
|
|
315
337
|
|