fix: wait longer for history due to slow audio upload

This commit is contained in:
Jannik committed 2026-09-06 01:08:25 +02:00
1 parent 1a696defab
commit 593d18089b
1 file changed
+16 -7
+16 -7
View File
@@ -177,19 +177,28 @@ async function processJob({ jsonPath, job, expectedVideoPath, targetFormat }) {
// 4. Render-Knopf drücken
console.log('🚀 Starte Export-Prozess...');
await page.click('#btnStartExport');
await page.evaluate(() => {
document.getElementById('btnStartExport').click();
});
// 5. Überwache den History API Endpunkt
console.log('⏳ Warte auf den Abschluss des Renderings...');
console.log('⏳ Warte auf den Abschluss des Renderings (Audio-Upload an Server läuft...)');
let isDone = false;
let lastStatus = '';
await new Promise(r => setTimeout(r, 4000));
// Wir pollen die History, bis ein Job auftaucht (Upload kann etwas dauern!)
let history = [];
let attempts = 0;
while (history.length === 0 && attempts < 30) {
await new Promise(r => setTimeout(r, 2000));
try {
const historyRes = await fetch(`${VIZ_URL}/api/export/history`);
history = await historyRes.json();
} catch(e) {}
attempts++;
}
const historyRes = await fetch(`${VIZ_URL}/api/export/history`);
const history = await historyRes.json();
if (history.length === 0) throw new Error('Kein Export-Job in History gefunden');
if (history.length === 0) throw new Error('Kein Export-Job in History gefunden (Timeout nach 60s)');
const sessionId = history[0].id;
console.log(`🔗 Session ID ermittelt: ${sessionId}`);