Skip to content

Instantly share code, notes, and snippets.

@bradoyler
Created January 31, 2013 17:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradoyler/4684553 to your computer and use it in GitHub Desktop.
Save bradoyler/4684553 to your computer and use it in GitHub Desktop.
Needed for unit testing. This ensures RavenDB will wait for non-stale results for any query.
// somewhere in your test’s setup
documentStore.RegisterListener(new NoStaleQueriesAllowed());
public class NoStaleQueriesAllowed : IDocumentQueryListener
{
public void BeforeQueryExecuted(IDocumentQueryCustomization queryCustomization)
{
queryCustomization.WaitForNonStaleResults();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment