mirror of
https://github.com/andwati/dokploy.git
synced 2026-10-23 05:22:18 +00:00
fix: don't cancel schedule deployments running outside the panel process on restart (#5053)
Fixes #4986. initCancelDeployments blindly marked every 'running' deployment as 'cancelled' on boot, including schedule runs whose actual work (docker exec into another container, or SSH to a remote host) is decoupled from the Dokploy process and keeps running after a restart. Now only deployments with no schedule, or schedules of type dokploy-server (a real child process), get cancelled. Also resolve any stale 'running' deployment for a schedule when a new run starts, so restarted panels don't leave ghost 'running' rows forever.
This commit is contained in:
@@ -453,6 +453,19 @@ export const createDeploymentSchedule = async (
|
||||
schedule.compose?.serverId ||
|
||||
schedule.server?.serverId;
|
||||
await removeLastTenDeployments(deployment.scheduleId, "schedule", serverId);
|
||||
await db
|
||||
.update(deployments)
|
||||
.set({
|
||||
status: "error",
|
||||
errorMessage: "Superseded by a new run of this schedule.",
|
||||
finishedAt: new Date().toISOString(),
|
||||
})
|
||||
.where(
|
||||
and(
|
||||
eq(deployments.scheduleId, deployment.scheduleId),
|
||||
eq(deployments.status, "running"),
|
||||
),
|
||||
);
|
||||
try {
|
||||
const { SCHEDULES_PATH } = paths(!!serverId);
|
||||
const formattedDateTime = format(new Date(), "yyyy-MM-dd:HH:mm:ss");
|
||||
|
||||
Reference in New Issue
Block a user