-
-
Notifications
You must be signed in to change notification settings - Fork 506
Open
Description
Im running into an issue when using QueryForNonStaleData
. OperationCanceledException
is thrown (after the provided timespan has occured) when no documents of the queried type/document exists. When i am using the IQuerySession.Query<T>
method it works fine. After populating the database with an event of type MyReadModelCreatedEvent
, the event is handled and my document is created. After the creation of the document, QueryForNonStaleData
resolves inside the specified timespan and returns the created document.
This is my projection:
public class MyProjection : SingleStreamProjection<MyReadModel, string>
{
public MyReadModel Create(IEvent<MyReadModelCreatedEvent> @event)
{
return new MyReadModel(/* creating object */)
}
}
public class MyReadModelRepository(IQuerySession session) : IMyReadModelRepository
{
public async Task<IReadOnlyList<MyReadModel>> GetMyReadModelForSomeIndex(string indexId, CancellationToken cancellationToken)
{
return await session
.QueryForNonStaleData<MyReadModel>(5.Seconds())
.Where(x => x.IndexId== indexId)
.ToListAsync(cancellationToken);
}
}
I have setup the following for the document:
options.Schema.For<MyReadModel>()
.Identity(x => x.SomeId)
.Index(x => x.IndexId);
Multi tenant is also set up with following settings:
options.Events.TenancyStyle = TenancyStyle.Conjoined;
options.Advanced.DefaultTenantUsageEnabled = false;
options.Policies.AllDocumentsAreMultiTenanted();
options.Policies.PartitionMultiTenantedDocumentsUsingMartenManagement("mySchema");
Metadata
Metadata
Assignees
Labels
No labels