mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-17 23:04:07 +01:00
only update last checked after updates were performed without errors
This commit is contained in:
@@ -79,6 +79,7 @@ public class NvdCveUpdater extends BaseUpdater implements CachedWebDataSource {
|
|||||||
if (updateable.isUpdateNeeded()) {
|
if (updateable.isUpdateNeeded()) {
|
||||||
performUpdate(updateable);
|
performUpdate(updateable);
|
||||||
}
|
}
|
||||||
|
getProperties().save(DatabaseProperties.LAST_CHECKED, Long.toString(System.currentTimeMillis()));
|
||||||
}
|
}
|
||||||
} catch (MalformedURLException ex) {
|
} catch (MalformedURLException ex) {
|
||||||
LOGGER.warn(
|
LOGGER.warn(
|
||||||
@@ -115,9 +116,7 @@ public class NvdCveUpdater extends BaseUpdater implements CachedWebDataSource {
|
|||||||
final long lastChecked = Long.parseLong(getProperties().getProperty(DatabaseProperties.LAST_CHECKED, "0"));
|
final long lastChecked = Long.parseLong(getProperties().getProperty(DatabaseProperties.LAST_CHECKED, "0"));
|
||||||
final long now = System.currentTimeMillis();
|
final long now = System.currentTimeMillis();
|
||||||
proceed = (now - lastChecked) > msValid;
|
proceed = (now - lastChecked) > msValid;
|
||||||
if (proceed) {
|
if (!proceed) {
|
||||||
getProperties().save(DatabaseProperties.LAST_CHECKED, Long.toString(now));
|
|
||||||
} else {
|
|
||||||
LOGGER.info("Skipping NVD check since last check was within {} hours.", validForHours);
|
LOGGER.info("Skipping NVD check since last check was within {} hours.", validForHours);
|
||||||
LOGGER.debug("Last NVD was at {}, and now {} is within {} ms.",
|
LOGGER.debug("Last NVD was at {}, and now {} is within {} ms.",
|
||||||
lastChecked, now, msValid);
|
lastChecked, now, msValid);
|
||||||
@@ -339,5 +338,4 @@ public class NvdCveUpdater extends BaseUpdater implements CachedWebDataSource {
|
|||||||
}
|
}
|
||||||
return updates;
|
return updates;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user