Created
February 2, 2012 01:08
-
-
Save csainty/1720587 to your computer and use it in GitHub Desktop.
BlogPost : Bugs
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
$('body').ajaxComplete(function (event, xhrRequest, ajaxOptions) { | |
var id = xhrRequest.getResponseHeader('X-RavenDb-Profiling-Id'); | |
if (id) | |
fetchResults(id.split(', ')); | |
}); | |
var fetchResults = function (id) { | |
$.get(options.url, { id: id }, function (obj) { | |
if (obj) | |
addResult(obj); | |
}, 'json'); | |
}; |
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
public void AddStore(IDocumentStore store) | |
{ | |
var documentStore = store as DocumentStore; | |
if (documentStore == null) | |
return; | |
if (documentStore.WasDisposed) | |
return; | |
object _; | |
documentStore.AfterDispose += (sender, args) => stores.TryRemove(documentStore, out _); | |
documentStore.SessionCreatedInternal += OnSessionCreated; | |
stores.TryAdd(documentStore, null); | |
} | |
private void OnSessionCreated(InMemoryDocumentSessionOperations operations) | |
{ | |
RavenProfiler.ContextualSessionList.Add(operations.Id); | |
if (HttpContext.Current == null) | |
return; | |
try | |
{ | |
HttpContext.Current.Response.AddHeader("X-RavenDb-Profiling-Id", operations.Id.ToString()); | |
} | |
catch (HttpException) | |
{ | |
// headers were already written, nothing much that we can do here, ignoring | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment