Skip to content

Commit

Permalink
Check for an existing restore event before trying to restore a checkp…
Browse files Browse the repository at this point in the history
…oint
  • Loading branch information
ericallam committed May 16, 2024
1 parent 598906f commit c0b815c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions apps/webapp/app/v3/services/restoreCheckpoint.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,22 @@ export class RestoreCheckpointService extends BaseService {
return;
}

const restoreEvent = await this._prisma.checkpointRestoreEvent.findFirst({
where: {
checkpointId: checkpoint.id,
type: "RESTORE",
},
});

if (restoreEvent) {
logger.error("Restore event already exists", {
checkpointId: checkpoint.id,
restoreEventId: restoreEvent.id,
});

return;
}

const eventService = new CreateCheckpointRestoreEventService(this._prisma);
await eventService.restore({ checkpointId: checkpoint.id });

Expand Down

0 comments on commit c0b815c

Please sign in to comment.