@@ -60,6 +60,10 @@ protected List<RotatingSaltProvider.SaltSnapshot> getSnapshots(RotatingSaltProvi
6060 List <RotatingSaltProvider .SaltSnapshot > filteredSnapshots = new ArrayList <>();
6161
6262 for (RotatingSaltProvider .SaltSnapshot snapshot : snapshots ) {
63+ if (!now .isBefore (snapshot .getExpires ())) {
64+ LOGGER .info ("Skipping expired snapshot, effective=" + snapshot .getEffective () + ", expires=" + snapshot .getExpires ());
65+ continue ;
66+ }
6367 if (newestEffectiveSnapshot != null && snapshot != newestEffectiveSnapshot ) {
6468 LOGGER .info ("Skipping effective snapshot, effective=" + snapshot .getEffective () + ", expires=" + snapshot .getExpires ()
6569 + " in favour of newer snapshot, effective=" + newestEffectiveSnapshot .getEffective () + ", expires=" + newestEffectiveSnapshot .getExpires ());
@@ -95,13 +99,7 @@ public void upload(RotatingSaltProvider.SaltSnapshot data) throws Exception {
9599 List <RotatingSaltProvider .SaltSnapshot > snapshots = this .getSnapshots (data );
96100
97101 for (RotatingSaltProvider .SaltSnapshot snapshot : snapshots ) {
98- if (!now .isBefore (snapshot .getExpires ())) {
99- LOGGER .info ("Skipping expired snapshot, effective=" + snapshot .getEffective () + ", expires=" + snapshot .getExpires ());
100- continue ;
101- }
102-
103102 final String location = getSaltSnapshotLocation (snapshot );
104-
105103 final JsonObject snapshotMetadata = new JsonObject ();
106104 snapshotMetadata .put ("effective" , snapshot .getEffective ().toEpochMilli ());
107105 snapshotMetadata .put ("expires" , snapshot .getExpires ().toEpochMilli ());
0 commit comments