fix: load logs after build failed

This commit is contained in:
Andras Bacsai
2022-11-23 11:51:19 +01:00
parent 8793c00438
commit 34ff6eb567

View File

@@ -61,12 +61,27 @@
fromDb = from; fromDb = from;
streamInterval = setInterval(async () => { streamInterval = setInterval(async () => {
const nextSequence = logs[logs.length - 1]?.time || 0;
if (status !== 'running' && status !== 'queued') { if (status !== 'running' && status !== 'queued') {
loading = false; loading = false;
try {
const data = await get(
`/applications/${id}/logs/build/${$selectedBuildId}?sequence=${nextSequence}`
);
status = data.status;
currentStatus = status;
fromDb = data.fromDb;
logs = logs.concat(
data.logs.map((log: any) => ({ ...log, line: cleanAnsiCodes(log.line) }))
);
loading = false;
} catch (error) {
return errorNotification(error);
}
clearInterval(streamInterval); clearInterval(streamInterval);
return; return;
} }
const nextSequence = logs[logs.length - 1]?.time || 0;
try { try {
const data = await get( const data = await get(
`/applications/${id}/logs/build/${$selectedBuildId}?sequence=${nextSequence}` `/applications/${id}/logs/build/${$selectedBuildId}?sequence=${nextSequence}`