Skip to content

Commit

Permalink
RavenDB-20123 Properly waiting for cache to be outdated
Browse files Browse the repository at this point in the history
  • Loading branch information
haludi committed Mar 20, 2024
1 parent 7dc98e7 commit 53dd645
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions test/SlowTests/Bugs/Caching/UseCachingInLazyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Raven.Client.Documents.Commands.MultiGet;
using Raven.Client.Documents.Session;
using Raven.Client.Documents.Session.Operations;
using Raven.Client.Extensions;
using Raven.Client.Http;
using Sparrow;
using Sparrow.Json;
Expand All @@ -17,7 +16,6 @@
using Xunit;
using Xunit.Abstractions;
using Size = Sparrow.Size;
using TimeoutException = System.TimeoutException;

namespace SlowTests.Bugs.Caching
{
Expand Down Expand Up @@ -209,19 +207,17 @@ public async Task LazilyLoad_WhenTrackChangesAndDoesntChange_ShouldNotCreateExtr
{
loadFunc(session, docId);
}

if (createVersion2)
{
var amre = new AsyncManualResetEvent();
var observable = store.Changes().ForDocument(docId);
await observable.EnsureSubscribedNow();
observable.Subscribe(_ => amre.Set());
var httpCache = store.GetRequestExecutor().Cache;
var prev = httpCache.Generation;

using var session = store.OpenAsyncSession();
await session.StoreAsync(new Doc { Version = "2" }, docId);
await session.SaveChangesAsync();

await amre.WaitAsync(TimeSpan.FromSeconds(30));
await WaitForGreaterThanAsync(() => Task.FromResult(httpCache.Generation), prev);
}

using (var session = store.OpenSession())
Expand Down

0 comments on commit 53dd645

Please sign in to comment.