Permalink
Browse files

Workaround for the timeout problem

  • Loading branch information...
1 parent 6cb5ad0 commit 18e7e684b3bb317044c7dee349283740626b8b2d @ayende ayende committed Nov 1, 2011
Showing with 16 additions and 0 deletions.
  1. +16 −0 Raven.Database/DocumentDatabase.cs
@@ -703,6 +703,9 @@ public QueryResult Query(string index, IndexQuery query)
throw new InvalidOperationException("Could not find index named: " + index);
stale = actions.Staleness.IsIndexStale(index, query.Cutoff, query.CutoffEtag);
+
+ AskForIndexUpdateIfStale(stale);
+
indexTimestamp = actions.Staleness.IndexLastUpdatedAt(index);
var indexFailureInformation = actions.Indexing.GetFailureRate(index);
if (indexFailureInformation.IsInvalidIndex)
@@ -767,6 +770,19 @@ into doc
};
}
+ private void AskForIndexUpdateIfStale(bool stale)
+ {
+ if (stale == false)
+ return;
+
+ // This is a sort of a hack
+ // Using it in this manner ensures that even if we somehow lost an update, we would still
+ // kick up indexing, anyway, because the querying for this would trigger that.
+ // This doesn't mean that we don't have a problem with losing updates, mind, just that we have
+ // no way to reproduce this.
+ workContext.ShouldNotifyAboutWork();
+ }
+
public IEnumerable<string> QueryDocumentIds(string index, IndexQuery query, out bool stale)
{
index = IndexDefinitionStorage.FixupIndexName(index);

0 comments on commit 18e7e68

Please sign in to comment.