diff --git a/src/main/java/com/uid2/admin/store/writer/SaltStoreWriter.java b/src/main/java/com/uid2/admin/store/writer/SaltStoreWriter.java index 45e764b8..b72db1dd 100644 --- a/src/main/java/com/uid2/admin/store/writer/SaltStoreWriter.java +++ b/src/main/java/com/uid2/admin/store/writer/SaltStoreWriter.java @@ -60,6 +60,10 @@ protected List getSnapshots(RotatingSaltProvi List filteredSnapshots = new ArrayList<>(); for (RotatingSaltProvider.SaltSnapshot snapshot : snapshots) { + if (!now.isBefore(snapshot.getExpires())) { + LOGGER.info("Skipping expired snapshot, effective=" + snapshot.getEffective() + ", expires=" + snapshot.getExpires()); + continue; + } if (newestEffectiveSnapshot != null && snapshot != newestEffectiveSnapshot) { LOGGER.info("Skipping effective snapshot, effective=" + snapshot.getEffective() + ", expires=" + snapshot.getExpires() + " in favour of newer snapshot, effective=" + newestEffectiveSnapshot.getEffective() + ", expires=" + newestEffectiveSnapshot.getExpires()); @@ -95,13 +99,7 @@ public void upload(RotatingSaltProvider.SaltSnapshot data) throws Exception { List snapshots = this.getSnapshots(data); for (RotatingSaltProvider.SaltSnapshot snapshot : snapshots) { - if (!now.isBefore(snapshot.getExpires())) { - LOGGER.info("Skipping expired snapshot, effective=" + snapshot.getEffective() + ", expires=" + snapshot.getExpires()); - continue; - } - final String location = getSaltSnapshotLocation(snapshot); - final JsonObject snapshotMetadata = new JsonObject(); snapshotMetadata.put("effective", snapshot.getEffective().toEpochMilli()); snapshotMetadata.put("expires", snapshot.getExpires().toEpochMilli());