Skip to content

Commit

Permalink
fix: synch last modified timestamp for NVD API (#6281)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylong authored Dec 12, 2023
1 parent 6769966 commit f14e0f9
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,15 @@ private boolean processDatafeed(String nvdDataFeedUrl) throws UpdateException {

private void storeLastModifiedDates(final ZonedDateTime now, final Properties cacheProperties,
final Map<String, String> updateable) throws UpdateException {

ZonedDateTime lastModifiedRequest = DatabaseProperties.getTimestamp(cacheProperties,
NVD_API_CACHE_MODIFIED_DATE + ".modified");
dbProperties.save(DatabaseProperties.NVD_CACHE_LAST_CHECKED, now);
dbProperties.save(DatabaseProperties.NVD_CACHE_LAST_MODIFIED, DatabaseProperties.getTimestamp(cacheProperties,
NVD_API_CACHE_MODIFIED_DATE + ".modified"));
dbProperties.save(DatabaseProperties.NVD_CACHE_LAST_MODIFIED, lastModifiedRequest);
//allow users to initially load from a cache but then use the API - this may happen with the GH Action
dbProperties.save(DatabaseProperties.NVD_API_LAST_CHECKED, now);
dbProperties.save(DatabaseProperties.NVD_API_LAST_MODIFIED, lastModifiedRequest);

for (String entry : updateable.keySet()) {
final ZonedDateTime date = DatabaseProperties.getTimestamp(cacheProperties, NVD_API_CACHE_MODIFIED_DATE + "." + entry);
dbProperties.save(DatabaseProperties.NVD_CACHE_LAST_MODIFIED + "." + entry, date);
Expand Down

0 comments on commit f14e0f9

Please sign in to comment.