-
Notifications
You must be signed in to change notification settings - Fork 654
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
WIP fix/implement caching upstream #93 #102
Conversation
For read-through caching, queries to registration and package service must be directed to upstream server. Otherwise client would get always 404 because there is nothing in the cache to begin with. We can add caching queries too, but that requires integrating catalog reader to refresh responses for already cached packages.
@@ -9,6 +11,19 @@ namespace BaGet.Core.Mirror | |||
/// </summary> | |||
public class FakeMirrorService : IMirrorService | |||
{ | |||
Task<IReadOnlyList<string>> emptyVersions = Task.Factory.StartNew(() => new List<string>() as IReadOnlyList<string>); |
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.
Instead of Task.Factory.StartNew
, how about Task.FromResult
?
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.
Will do.
Thank you for tackling this! I think your current solution has a flaw. Say package
This is a tough problem to solve. A possible solution may be to always contact the upstream source. This may be feasible as the NuGet client caches HTTP responses. What're your thoughts @tomzo? |
HasReadme = false; // | ||
IconUrl = NullSafeToString(package.IconUrl); | ||
Language = null; // | ||
LicenseUrl = NullSafeToString(package.LicenseUrl); |
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.
What about just package.LicenseUrl?.ToString();
?
Second endpoint would solve that too.
|
For read-through caching, queries to registration and package service
must be directed to upstream server. Otherwise client would get always
404 because there is nothing in the cache to begin with.
We can add caching queries too, but that requires integrating catalog
reader to refresh responses for already cached packages.
What does this PR do?
Fixes read-through cache.
Closes Issue(s)
#93
Additional Notes
"PackageSource": "https://api.nuget.org/v3-flatcontainer/"
. I think we need to specify full URL to the index of nuget server. Such as"https://api.nuget.org/v3/index.json"
.