Created
May 8, 2014 10:58
-
-
Save kjnilsson/300a7693f401ca104512 to your computer and use it in GitHub Desktop.
Delegating handler to capture request processing times
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type TimingHandler() = | |
inherit DelegatingHandler () | |
let cont (sw : Stopwatch) (t: Task<HttpResponseMessage>) = | |
sw.Stop() | |
debug "request time: %i" sw.ElapsedMilliseconds | |
t.Result // dont like this | |
override this.SendAsync (request, token) = | |
let sw = new Stopwatch() | |
sw.Start() | |
base.SendAsync(request, token) | |
.ContinueWith(cont sw, token) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment