Skip to content

Commit

Permalink
Log Request performance
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Oct 19, 2015
1 parent 82bddfe commit 8968df9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 2.15.6 - 19.10.2015
* Log Request performance

#### 2.15.5 - 19.10.2015
* BUGFIX: Fixed loading of Project files on mono - https://github.com/fsprojects/Paket/pull/1149

Expand Down
16 changes: 13 additions & 3 deletions src/Paket.Core/NuGetV2.fs
Original file line number Diff line number Diff line change
Expand Up @@ -62,47 +62,57 @@ let rec private followODataLink auth url =
}



let tryGetAllVersionsFromNugetODataWithFilter (auth, nugetURL, package:PackageName) =
async {
try
let sw = System.Diagnostics.Stopwatch.StartNew()
let url = sprintf "%s/Packages?$filter=Id eq '%O'" nugetURL package
verbosefn "getAllVersionsFromNugetODataWithFilter from url '%s'" url
let! result = followODataLink auth url
traceVerbose <| sprintf "PERF: ODataWithFilter %O: %dms" package sw.ElapsedMilliseconds
return Some result
with _ -> return None
}

let tryGetPackageVersionsViaOData (auth, nugetURL, package:PackageName) =
async {
try
let sw = System.Diagnostics.Stopwatch.StartNew()
let url = sprintf "%s/FindPackagesById()?id='%O'" nugetURL package
verbosefn "getAllVersionsFromNugetOData from url '%s'" url
let! result = followODataLink auth url
traceVerbose <| sprintf "PERF: OData %O: %dms" package sw.ElapsedMilliseconds
return Some result
with _ -> return None
}

let tryGetPackageVersionsViaJson (auth, nugetURL, package:PackageName) =
async {
let sw = System.Diagnostics.Stopwatch.StartNew()
let url = sprintf "%s/package-versions/%O?includePrerelease=true" nugetURL package
let! raw = safeGetFromUrl (auth, url, acceptJson)

match raw with
| None -> return None
| Some data ->
try
traceVerbose <| sprintf "PERF: json %O: %dms" package sw.ElapsedMilliseconds
return Some(JsonConvert.DeserializeObject<string []> data)
with _ -> return None
}

let tryNuGetV3 (auth, nugetV3Url, package:PackageName) =
async {
try
async {
try
let sw = System.Diagnostics.Stopwatch.StartNew()
let! data = NuGetV3.findVersionsForPackage(nugetV3Url, auth, package, true, 100000)
match data with
| Some data when Array.isEmpty data -> return None
| None -> return None
| _ -> return data
| _ ->
traceVerbose <| sprintf "PERF: V3 %O: %dms" package sw.ElapsedMilliseconds
return data
with exn -> return None
}

Expand Down
4 changes: 2 additions & 2 deletions src/Paket/Paket.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
<StartArguments>update group Build</StartArguments>
<StartArguments>pack output D:\code\paketbug\output</StartArguments>
<StartArguments>install</StartArguments>
<StartArguments>update</StartArguments>
<StartArguments>update -v --log-file C:\temp\paketlog.txt</StartArguments>
<StartAction>Project</StartAction>
<StartProgram>paket.exe</StartProgram>
<StartWorkingDirectory>c:\code\Paketkopie</StartWorkingDirectory>
<StartWorkingDirectory>C:\Temp\paket_test\</StartWorkingDirectory>
<StartWorkingDirectory>d:\code\paketkopie</StartWorkingDirectory>
<StartWorkingDirectory>d:\code\paketbug</StartWorkingDirectory>
<StartWorkingDirectory>d:\code\paketrepro</StartWorkingDirectory>
<StartWorkingDirectory>c:\code\Paketkopie</StartWorkingDirectory>
<StartWorkingDirectory>d:\code\paketbug</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand Down

0 comments on commit 8968df9

Please sign in to comment.