Skip to content

Commit 40d80f9

Browse files
committed
Revert "prevent creating checkpoints for outdated task waits"
This reverts commit 11066b4.
1 parent e6afbb4 commit 40d80f9

File tree

1 file changed

+3
-49
lines changed

1 file changed

+3
-49
lines changed

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

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,7 @@ export class CreateCheckpointService extends BaseService {
3535
friendlyId: params.attemptFriendlyId,
3636
},
3737
include: {
38-
taskRun: {
39-
include: {
40-
childRuns: {
41-
orderBy: {
42-
createdAt: "asc",
43-
},
44-
take: 1,
45-
},
46-
},
47-
},
38+
taskRun: true,
4839
backgroundWorker: {
4940
select: {
5041
id: true,
@@ -102,45 +93,6 @@ export class CreateCheckpointService extends BaseService {
10293
};
10394
}
10495

105-
const { reason } = params;
106-
107-
switch (reason.type) {
108-
case "WAIT_FOR_TASK": {
109-
const lastChildRun = attempt.taskRun.childRuns[0];
110-
111-
if (!lastChildRun) {
112-
logger.warn("CreateCheckpointService: No child runs, creating checkpoint regardless", {
113-
attemptId: attempt.id,
114-
runId: attempt.taskRunId,
115-
params,
116-
});
117-
118-
break;
119-
}
120-
121-
if (lastChildRun.friendlyId !== reason.friendlyId) {
122-
logger.error("CreateCheckpointService: Checkpoint not for most recent child run", {
123-
attemptId: attempt.id,
124-
runId: attempt.taskRunId,
125-
params,
126-
});
127-
128-
return {
129-
success: false,
130-
keepRunAlive: true,
131-
};
132-
}
133-
134-
break;
135-
}
136-
case "WAIT_FOR_BATCH": {
137-
break;
138-
}
139-
default: {
140-
break;
141-
}
142-
}
143-
14496
//sleep to test slow checkpoints
14597
// await new Promise((resolve) => setTimeout(resolve, 60_000));
14698

@@ -176,6 +128,8 @@ export class CreateCheckpointService extends BaseService {
176128
},
177129
});
178130

131+
const { reason } = params;
132+
179133
let checkpointEvent: CheckpointRestoreEvent | undefined;
180134

181135
switch (reason.type) {

0 commit comments

Comments
 (0)