Skip to content

Commit

Permalink
Modified must be set before setting obsolete metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmalloy committed Sep 14, 2023
1 parent a77d08a commit 8c91fc8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/jasper/component/Ingest.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public class Ingest {
public void ingest(Ref ref, boolean force) {
if (refRepository.existsByUrlAndOrigin(ref.getUrl(), ref.getOrigin())) throw new AlreadyExistsException();
ref.addHierarchicalTags();
ref.setCreated(Instant.now());
ref.setModified(Instant.now());
validate.ref(ref, force);
meta.update(ref, null, null);
ref.setCreated(Instant.now());
Expand All @@ -51,6 +53,7 @@ public void update(Ref ref, boolean force) {
var maybeExisting = refRepository.findOneByUrlAndOrigin(ref.getUrl(), ref.getOrigin());
if (maybeExisting.isEmpty()) throw new NotFoundException("Ref");
ref.addHierarchicalTags();
ref.setModified(Instant.now());
validate.ref(ref, force);
meta.update(ref, maybeExisting.get(), null);
ensureUniqueModified(ref);
Expand All @@ -60,6 +63,7 @@ public void update(Ref ref, boolean force) {
public void push(Ref ref, List<String> metadataPlugins) {
var maybeExisting = refRepository.findOneByUrlAndOrigin(ref.getUrl(), ref.getOrigin());
ref.addHierarchicalTags();
ref.setModified(Instant.now());
validate.ref(ref, true);
meta.update(ref, maybeExisting.orElse(null), metadataPlugins);
refRepository.save(ref);
Expand Down

0 comments on commit 8c91fc8

Please sign in to comment.