Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: cancel build after 5 seconds

Andras Bacsai359434bfd3c5
diff --git a/apps/api/src/lib/common.ts b/apps/api/src/lib/common.ts
index 866053cc4c..a69901a524 100644
--- a/apps/api/src/lib/common.ts
+++ b/apps/api/src/lib/common.ts
@@ -1795,11 +1795,11 @@ export async function stopBuild(buildId, applicationId) {
clearInterval(interval);
return resolve();
}
- if (count > 100) {
+ if (count > 50) {
clearInterval(interval);
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) {
const containersArray = buildContainers.trim().split('\n');
for (const container of containersArray) {
@@ -1807,14 +1807,15 @@ export async function stopBuild(buildId, applicationId) {
const id = containerObj.ID;
if (!containerObj.Names.startsWith(`${applicationId} `)) {
await removeContainer({ id, dockerId });
- await cleanupDB(buildId);
clearInterval(interval);
return resolve();
}
}
}
count++;
- } catch (error) { }
+ } catch (error) { } finally {
+ await cleanupDB(buildId);
+ }
}, 100);
});
}