From: Serban Jora Date: Wed, 10 Jan 2018 00:40:48 +0000 (-0500) Subject: fix artifact update condition X-Git-Tag: 1.1.4.1~39 X-Git-Url: https://gerrit.acumos.org/r/gitweb?p=federation.git;a=commitdiff_plain;h=3bbf80a2cfa66f415638091268098ffbfe0c080d fix artifact update condition Change-Id: If844b885ab33f18c0ba2d5724eecebdbb5f22ab1 Signed-off-by: Serban Jora --- diff --git a/gateway/src/main/java/org/acumos/federation/gateway/adapter/PeerGateway.java b/gateway/src/main/java/org/acumos/federation/gateway/adapter/PeerGateway.java index 61f6e15..c8c81ab 100644 --- a/gateway/src/main/java/org/acumos/federation/gateway/adapter/PeerGateway.java +++ b/gateway/src/main/java/org/acumos/federation/gateway/adapter/PeerGateway.java @@ -429,19 +429,22 @@ public class PeerGateway { cdsClient); } else { - //an update might not actually be necessary but we cannot compare - //timestamps as they are locally generated - localArtifact = updateMLPArtifact(peerArtifact, localArtifact, cdsClient); + //check version + if (!peerArtifact.getVersion().equals(localArtifact.getVersion())) { + localArtifact = updateMLPArtifact(peerArtifact, localArtifact, cdsClient); + } + else { + //mark the fact that loca artifact does not need an update + localArtifact = null; + } } //TODO: add the delete of those who are not available anymore - //if (localArtifact == null) { - //not transactional .. hard to recover from, we'll re-attempt - //next time we process the enclosing solution/revision (should be - //marked accordingly) - //if anything happened an exception - //} + if (localArtifact == null) { + //the artifact does not need an update + continue; + } //artifacts file download and push it to nexus: we continue here //as we persisted the peer URI