From 3bbf80a2cfa66f415638091268098ffbfe0c080d Mon Sep 17 00:00:00 2001 From: Serban Jora Date: Tue, 9 Jan 2018 19:40:48 -0500 Subject: [PATCH] fix artifact update condition Change-Id: If844b885ab33f18c0ba2d5724eecebdbb5f22ab1 Signed-off-by: Serban Jora --- .../federation/gateway/adapter/PeerGateway.java | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) 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 -- 2.16.6