Skip to content
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

Only overwrite NuGet metadata cache when needed, cleanup and exception handling #2998

Merged
merged 1 commit into from Jan 18, 2018

Conversation

viktor-svub
Copy link
Contributor

Cleaned up NuGet metadata cache access based on production experience:

1/ with explicit "force", do not re/query and overwrite the metadata cache twice

2/ stale cache file cleanup should not be performed on every single read -- doing this only on "force" seems like a good idea, there is "paket clear-cache" in case more "forceful" solution is needed

3/ do not overwrite cached metadata on each access with "force", if the content already equals -- the read and comparison is faster and does not cause file-access violations

let cacheFile, oldFiles = getCacheFiles NuGetPackageCache.CurrentCacheVersion nugetURL packageName version
for f in oldFiles do
File.Delete f
let cacheFile = getCacheFiles force NuGetPackageCache.CurrentCacheVersion nugetURL packageName version
let get() =
async {
let! result = get()
match result with
| ODataSearchResult.Match result ->
File.WriteAllText(cacheFile.FullName,JsonConvert.SerializeObject(result))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this line now needs to go

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will remove it myself.

@forki
Copy link
Member

forki commented Jan 18, 2018

Awesome. Keep them coming ;-)

@forki forki merged commit 61186c3 into fsprojects:master Jan 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants