diff --git a/apps/dokploy/server/server.ts b/apps/dokploy/server/server.ts index eaf562695..d06ab38f1 100644 --- a/apps/dokploy/server/server.ts +++ b/apps/dokploy/server/server.ts @@ -43,6 +43,7 @@ void app.prepare().then(async () => { if (!IS_CLOUD) { setupDockerStatsMonitoringSocketServer(server); } + await initCancelDeployments(); if (process.env.NODE_ENV === "production" && !IS_CLOUD) { setupDirectories(); @@ -53,7 +54,6 @@ void app.prepare().then(async () => { await migration(); await initCronJobs(); await initSchedules(); - await initCancelDeployments(); await initVolumeBackupsCronJobs(); await sendDokployRestartNotifications(); } diff --git a/packages/server/src/utils/startup/cancell-deployments.ts b/packages/server/src/utils/startup/cancell-deployments.ts index df7b70900..16e76a32c 100644 --- a/packages/server/src/utils/startup/cancell-deployments.ts +++ b/packages/server/src/utils/startup/cancell-deployments.ts @@ -7,8 +7,8 @@ export const initCancelDeployments = async () => { console.log("Setting up cancel deployments...."); const result = await db.update(deployments).set({ - status: "error", - }).where(eq(deployments.status, "cancelled")); + status: "cancelled", + }).where(eq(deployments.status, "running")).returning(); console.log(`Cancelled ${result.length} deployments`); } catch (error) {