Skip to content

Commit

Permalink
Fixing some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ktuite committed Aug 16, 2024
1 parent 7ae0259 commit 387549a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/model/query/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ const _getHeldSubmissionsAsEvents = () => ({ all }) => all(sql`
ORDER BY "branchId", "branchBaseVersion"`)
.then(map(construct(Audit)));

// Used to de-queue a held submission when it is force-processed.
const _deleteHeldSubmissionByEventId = (eventId) => ({ run }) => run(sql`
DELETE FROM entity_submission_backlog
WHERE "auditId"=${eventId}`);
Expand Down Expand Up @@ -258,14 +259,13 @@ const _computeBaseVersion = (eventId, dataset, clientEntity, submissionDef, forc

if (!baseEntityVersion.isDefined()) {
if (forceOutOfOrderProcessing) {
// if the base version doesn't exist but we forcing the update anyway,
// use the latest version on the server as the base.
// TODO: if that can't be found, maybe we're in the magic apply update as create case.
// If the base version doesn't exist but we forcing the update anyway, use the latest version on the server as the base.
// If that can't be found, throw an error for _processSubmissionEvent to catch so it can try create instead of update.
const latestEntity = await Entities.getById(dataset.id, clientEntity.uuid)
.then(getOrReject(Problem.user.entityNotFound({ entityUuid: clientEntity.uuid, datasetName: dataset.name })));
return latestEntity.aux.currentVersion;
} else {
// In this case, we are not ready to process this submission and it will be held in the backlog.
// If there is no base version and we are not forcing the processing, hold submission in the backlog.
await Entities._holdSubmission(eventId, submissionDef.submissionId, submissionDef.id, clientEntity.def.branchId, clientEntity.def.baseVersion);
return null;
}
Expand Down

0 comments on commit 387549a

Please sign in to comment.