-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: per year bug fixes #268
base: scratch/memory-usage-per-year
Are you sure you want to change the base?
Conversation
Existing cache from yesterday - ran the update and it took 2632 seconds (~43 minutes). |
resolves #265
Fixed one minor bug and re-ran the update. 1943 seconds (32 minutes) later and the cache is updated (see the log). It is taking 149 requests to the NVD to update the cache when in reality if I updated the cache an hour ago - it should be a single API call to get all the data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, just docs and this is a good addition for sure
@@ -72,6 +72,7 @@ public class CveCommand extends AbstractNvdCommand { | |||
* Start year (until today) to cache CVEs for. | |||
*/ | |||
private static final int START_YEAR = 2002; | |||
private static final int EARLIEST_CVE_YEAR = 1988; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should either name the variables in a way it is obvious or document why both exist, or the next time, it will be not implemented the right way again :)
private void storeToCache(int year, CvesNvdPojo cves, CacheProperties properties) { | ||
int target = year; | ||
if (target < START_YEAR) { | ||
target = START_YEAR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add docs why this is needed and also reference the NVD docs you found on that. In the end, we fetch 1988-2002 as a special case, and store them in the year 2002 alltogether
Are you able to compare this with the old implementation? (not memory, rather a real test). Asking because i cannot do it myself, it does never finish, neither on my k8s cluster nor locally (either ooms or fails due to API errors). It would be nice to Current: We could use an entire separated fetch-logic for the modified file, which might be an easy fix and easy to implement. Idea
So we split both steps entirely, they fetching all years first or last will not matter, "year fetching" and "modify" fetching are separated entirely. With the current code structure, this can already be done fairly DRY. So what we do is, we split the efforts and using different strategies. This makes sense since 1. will load a huge amount of items (a magnitude more then 2. and thus we should rather focus on relyability, memory usage and consistency.
// rant on Still, if it is more reliable, i do not care it takes 30 mins ones a night. |
lastUpdated
is captured per year