Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/main/java/com/uid2/admin/store/writer/SaltStoreWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ protected List<RotatingSaltProvider.SaltSnapshot> getSnapshots(RotatingSaltProvi
List<RotatingSaltProvider.SaltSnapshot> 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());
Expand Down Expand Up @@ -95,13 +99,7 @@ public void upload(RotatingSaltProvider.SaltSnapshot data) throws Exception {
List<RotatingSaltProvider.SaltSnapshot> 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());
Expand Down