feat(video): wire video converters, resolution validation, and timeout into app.js/worker.js
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+6
-1
@@ -15,6 +15,7 @@ import { registerDfontConverter } from './converters/dfont.js';
|
||||
import { registerEbookConverter } from './converters/ebook.js';
|
||||
import { registerArchiveConverters } from './converters/archive.js';
|
||||
import { registerAudioConverters } from './converters/audio.js';
|
||||
import { registerVideoConverters } from './converters/video.js';
|
||||
import { findPendingJobs, markProcessing, markDone, markFailed } from './jobs/jobRepository.js';
|
||||
|
||||
const JOB_TIMEOUT_MS = 60000;
|
||||
@@ -39,7 +40,10 @@ async function processJob(prisma, config, job) {
|
||||
throw new Error(`No converter registered for ${job.sourceFormat} -> ${job.targetFormat}`);
|
||||
}
|
||||
|
||||
const timeoutMs = entry.family === 'ebook' ? config.ebookJobTimeoutMs : JOB_TIMEOUT_MS;
|
||||
const timeoutMs =
|
||||
entry.family === 'ebook' ? config.ebookJobTimeoutMs :
|
||||
entry.family === 'video' ? config.videoJobTimeoutMs :
|
||||
JOB_TIMEOUT_MS;
|
||||
const startedAt = Date.now();
|
||||
await withTimeout(
|
||||
entry.convert(inputFilePath, outputFilePath, { quality: job.quality, iconSize: job.iconSize, timeoutMs }),
|
||||
@@ -93,6 +97,7 @@ async function main() {
|
||||
registerEbookConverter();
|
||||
registerArchiveConverters();
|
||||
registerAudioConverters();
|
||||
registerVideoConverters();
|
||||
|
||||
startWorker(prisma, config);
|
||||
console.log(`Worker started, polling every ${config.workerPollIntervalMs}ms`);
|
||||
|
||||
Reference in New Issue
Block a user