Skip to content

Commit

Permalink
Revert "Log Request performance"
Browse files Browse the repository at this point in the history
This reverts commit 8968df9.
  • Loading branch information
forki committed Oct 19, 2015
1 parent 84653c3 commit a99c09b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
16 changes: 3 additions & 13 deletions src/Paket.Core/NuGetV2.fs
Original file line number Diff line number Diff line change
Expand Up @@ -62,57 +62,47 @@ 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
let sw = System.Diagnostics.Stopwatch.StartNew()
async {
try
let! data = NuGetV3.findVersionsForPackage(nugetV3Url, auth, package, true, 100000)
match data with
| Some data when Array.isEmpty data -> return None
| None -> return None
| _ ->
traceVerbose <| sprintf "PERF: V3 %O: %dms" package sw.ElapsedMilliseconds
return data
| _ -> return data
with exn -> return None
}

Expand Down
2 changes: 0 additions & 2 deletions src/Paket.Core/Utils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,8 @@ let safeGetFromUrl (auth:Auth option, url : string, contentType : string) =
if notNullOrEmpty contentType then
client.Headers.Add(HttpRequestHeader.Accept, contentType)

let sw2 = System.Diagnostics.Stopwatch.StartNew()
let s = client.DownloadStringTaskAsync(uri) |> Async.AwaitTask
let! raw = s
traceVerbose <| sprintf " - download was %dms" sw2.ElapsedMilliseconds
return Some raw
with _ -> return None
}
Expand Down

0 comments on commit a99c09b

Please sign in to comment.