WaitForNonStaleResultsAsOfNow() in RavenDB 4

189 views Asked by At

I can't seem to find the equivalent of WaitForNonStaleResultsAsOfNow() in RavenDB 4 .NET Client API.

In previous versions this was available through IRavenQueryable.Customize(), but now it contains only WaitForNonStaleResultsAsOf() and WaitForNonStaleResults(). The WaitForNonStaleResultsAsOf() accepts only an ETag and no DateTime.

Also, I tried looking for WaitForNonStaleResultsAsOfLastWrite(), but couldn't find that either. And I couldn't replicate the behaviour myself by using IDocumentStore.GetLastWrittenEtag() since it is not present in 4.0.

Digging around a bit more I found that the last ETag would be available on the Raven.Client.Documents.Operations.DatabaseStatistics-object received as a response of the Raven.Client.Documents.Commands.GetStatisticsCommand... But I can't figure out how to issue this command in 4.0 either :(

Any help on achieving this in RavenDB 4 would be greatly appreciated.

1

There are 1 answers

0
Fitzchak Yitzchaki On BEST ANSWER

In v4.0 you should only use WaitForNonStaleResults. It will work exactly as the WaitForNonStaleResultsAsOfNow was working. It is asking the server to wait on the query until the currently max etag of all the collections in the query.

Cutoff etag is used to check if the index has already process a document with the given etag. Unlike Cutoff, which uses dates and is susceptible to clock synchronization issues between machines, cutoff etag doesn't rely on both the server and client having a synchronized clock and can work without it.

WaitForNonStaleResultsAsOf is going to be removed from the client: http://issues.hibernatingrhinos.com/issue/RavenDB-9678