-
Notifications
You must be signed in to change notification settings - Fork 641
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
Utilize vulnerabilities caching service for in manage packages page #8620
Conversation
fb57d56
to
bab06bd
Compare
bab06bd
to
37865bb
Compare
How is perf looking? |
@skofman1 I'd like to see it in INT before evaluating, but this change introduces no new queries, simply a dictionary lookup. Perf on the caching itself (a different change for Package Details) is looking fine in INT, with no discernable regression in the INT Package Details page as it has many queries already and is not under high load. |
@skofman1 I've done some preliminary perf investigations (comparing enabling/disabling the feature) in DEV and:
This is different from the previous approach (direct SQL queries) where a consistent perf regression of ~1000ms applied to manage packages packages regardless of package list size. |
[Fact] | ||
public void GetsVulnerableStatusOfPackage() | ||
{ | ||
// Arrange | ||
Setup(); | ||
var entitiesContext = new Mock<IEntitiesContext>(); |
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.
For discussions: I am not very sure whether we need to set up and mock so many dependencies here. I can see that "PackageVulnerabilitiesService" only has one dependency: "IPackageVulnerabilitiesCacheService". Will it work if we just mock the method "_packageVulnerabilitiesCacheService.GetVulnerabilitiesById(id)"? This will help us keep the unit test efficient and clean with the minimal scope.
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.
Good call, Zhaohua--that simplifies the tests. I've included this change now.
83cfe00
to
0d080c6
Compare
{ | ||
Key = 0, | ||
PackageRegistration = registrationVulnerable, | ||
Version = "1.0.0", | ||
VulnerablePackageRanges = new List<VulnerablePackageVersionRange> {versionRangeModerate} | ||
VulnerablePackageRanges = new List<VulnerablePackageVersionRange> { versionRangeModerate } | ||
}; |
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.
It will be better if we have a test to cover the following case:
The package registration Id matches, but the package key can't be found in the dictionary returned by "GetVulnerabilitiesById".
Nice work! 👍 |
Addresses #8361, with a far more performant approach (no direct database queries) than #8435 which we've left behind a disabled feature flag for this reason. This change utilizes the cache set up here: #8580.