Skip to content

Commit 6919caa

Browse files
committed
fix: return the post-update row from failDeployment
1 parent cb09bb1 commit 6919caa

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

apps/webapp/app/v3/services/failDeployment.server.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,20 @@ export class FailDeploymentService extends BaseService {
6767
return;
6868
}
6969

70-
const failedDeployment = {
71-
...deployment,
72-
status: "FAILED" as const,
73-
failedAt,
74-
errorData: params.error,
75-
buildEnvVars: null,
76-
};
70+
// Re-read after the guarded write: the row can gain phase timestamps
71+
// between the initial read and the update, and callers expect the
72+
// post-update row.
73+
const failedDeployment = await this._prisma.workerDeployment.findFirst({
74+
where: { id: deployment.id },
75+
});
76+
77+
if (!failedDeployment) {
78+
logger.error("Worker deployment disappeared after fail transition", {
79+
id: deployment.id,
80+
friendlyId,
81+
});
82+
return;
83+
}
7784

7885
recordDeploymentLifecycle({
7986
status: "FAILED",

0 commit comments

Comments
 (0)