Skip to content

Commit c0b815c

Browse files
committed
Check for an existing restore event before trying to restore a checkpoint
1 parent 598906f commit c0b815c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,22 @@ export class RestoreCheckpointService extends BaseService {
8181
return;
8282
}
8383

84+
const restoreEvent = await this._prisma.checkpointRestoreEvent.findFirst({
85+
where: {
86+
checkpointId: checkpoint.id,
87+
type: "RESTORE",
88+
},
89+
});
90+
91+
if (restoreEvent) {
92+
logger.error("Restore event already exists", {
93+
checkpointId: checkpoint.id,
94+
restoreEventId: restoreEvent.id,
95+
});
96+
97+
return;
98+
}
99+
84100
const eventService = new CreateCheckpointRestoreEventService(this._prisma);
85101
await eventService.restore({ checkpointId: checkpoint.id });
86102

0 commit comments

Comments
 (0)