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

Projects
None yet
3 participants
@viktor-svub
Contributor

viktor-svub commented Jan 18, 2018

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))

This comment has been minimized.

@forki

forki Jan 18, 2018

Member

I assume this line now needs to go

This comment has been minimized.

@forki

forki Jan 18, 2018

Member

will remove it myself.

@forki

This comment has been minimized.

Member

forki commented Jan 18, 2018

Awesome. Keep them coming ;-)

@forki forki merged commit 61186c3 into fsprojects:master Jan 18, 2018

0 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment