Skip to content

Commit 536161f

Browse files
committed
Fixes some issues discovered after new tests
1 parent 591b67d commit 536161f

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

Orm/Xtensive.Orm/Orm/Providers/CommandProcessing/BatchingCommandProcessor.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,15 @@ private Command ExecuteBatch(int numberOfTasks, QueryRequest lastRequest, Comman
182182

183183
private async Task<Command> ExecuteBatchAsync(int numberOfTasks, QueryRequest lastRequest, CommandProcessorContext context, CancellationToken token)
184184
{
185-
var shouldReturnReader = lastRequest!=null;
186-
187-
if (numberOfTasks==0 && !shouldReturnReader) {
185+
if (numberOfTasks==0 && lastRequest==null) {
188186
return null;
189187
}
190188

191189
var tasksToProcess = context.ProcessingTasks;
192190

193191
AllocateCommand(context);
194192

193+
var shouldReturnReader = false;
195194
try {
196195
while (numberOfTasks > 0 && tasksToProcess.Count > 0) {
197196
var task = tasksToProcess.Peek();

Orm/Xtensive.Orm/Orm/Session.QueryTasks.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ internal async Task<bool> ExecuteDelayedUserQueriesAsync(bool skipPersist, Cance
5353
{
5454
token.ThrowIfCancellationRequested();
5555
if (!skipPersist)
56-
Persist(PersistReason.Other);
56+
Persist(PersistReason.Query);
5757
token.ThrowIfCancellationRequested();
58-
return await ProcessUserDefinedDelayedQueriesAsync(token).ConfigureAwait(false);
58+
return await ProcessUserDefinedDelayedQueriesAsync(false, token).ConfigureAwait(false);
5959
}
6060

6161
private bool ProcessUserDefinedDelayedQueries(bool allowPartialExecution)
@@ -84,13 +84,13 @@ private bool ProcessInternalDelayedQueries(bool allowPartialExecution)
8484
}
8585
}
8686

87-
private async Task<bool> ProcessUserDefinedDelayedQueriesAsync(CancellationToken token)
87+
private async Task<bool> ProcessUserDefinedDelayedQueriesAsync(bool allowPartialExecution, CancellationToken token)
8888
{
8989
if (userDefinedQueryTasks.Count==0)
9090
return false;
9191
var aliveTasks = userDefinedQueryTasks.Where(t => t.LifetimeToken.IsActive).ToList();
9292
userDefinedQueryTasks.Clear();
93-
await Handler.ExecuteQueryTasksAsync(aliveTasks, false, token).ConfigureAwait(false);
93+
await Handler.ExecuteQueryTasksAsync(aliveTasks, allowPartialExecution, token).ConfigureAwait(false);
9494
return true;
9595
}
9696
}

Orm/Xtensive.Orm/Orm/Session.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,9 @@ internal EnumerationContext CreateEnumerationContext()
249249

250250
internal async Task<EnumerationContext> CreateEnumerationContextForAsyncQuery(CancellationToken token)
251251
{
252-
Persist(PersistReason.Other);
252+
Persist(PersistReason.Query);
253253
token.ThrowIfCancellationRequested();
254-
await ProcessUserDefinedDelayedQueriesAsync(token).ConfigureAwait(false);
254+
await ProcessUserDefinedDelayedQueriesAsync(true, token).ConfigureAwait(false);
255255
return new Providers.EnumerationContext(this, GetEnumerationContextOptions());
256256
}
257257

0 commit comments

Comments
 (0)