fix: cancel build after 5 seconds
This commit is contained in:
@@ -1795,11 +1795,11 @@ export async function stopBuild(buildId, applicationId) {
|
|||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
return resolve();
|
return resolve();
|
||||||
}
|
}
|
||||||
if (count > 100) {
|
if (count > 50) {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
return reject(new Error('Build canceled'));
|
return reject(new Error('Build canceled'));
|
||||||
}
|
}
|
||||||
const { stdout: buildContainers } = await executeDockerCmd({ dockerId, command: `docker container ls--filter "label=coolify.buildId=${buildId}" --format '{{json .}}'` })
|
const { stdout: buildContainers } = await executeDockerCmd({ dockerId, command: `docker container ls --filter "label=coolify.buildId=${buildId}" --format '{{json .}}'` })
|
||||||
if (buildContainers) {
|
if (buildContainers) {
|
||||||
const containersArray = buildContainers.trim().split('\n');
|
const containersArray = buildContainers.trim().split('\n');
|
||||||
for (const container of containersArray) {
|
for (const container of containersArray) {
|
||||||
@@ -1807,14 +1807,15 @@ export async function stopBuild(buildId, applicationId) {
|
|||||||
const id = containerObj.ID;
|
const id = containerObj.ID;
|
||||||
if (!containerObj.Names.startsWith(`${applicationId} `)) {
|
if (!containerObj.Names.startsWith(`${applicationId} `)) {
|
||||||
await removeContainer({ id, dockerId });
|
await removeContainer({ id, dockerId });
|
||||||
await cleanupDB(buildId);
|
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
return resolve();
|
return resolve();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
} catch (error) { }
|
} catch (error) { } finally {
|
||||||
|
await cleanupDB(buildId);
|
||||||
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user