Skip to content

Commit 04804b8

Browse files
authored
Merge pull request #146 from DataObjects-NET/6.0-infinite-loop-on-batching
Fixes possible infinite loop on command batching
2 parents c16744c + e7a0bbc commit 04804b8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Orm/Xtensive.Orm.Tests/Storage/CommandProcessing/BatchingCommandProcessorParametersManagement.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public void InlineQueryInSeparateBatchTest()
192192
q.All<ALotOfFieldsEntityValid>().Where(e => e.Id.In(IncludeAlgorithm.ComplexCondition, ids))));
193193

194194
var inlineQuery = session.Query.All<ALotOfFieldsEntityValid>()
195-
.Where(e => e.Id.In(IncludeAlgorithm.ComplexCondition, new[] { 1, 2 }));
195+
.Where(e => e.Id.In(IncludeAlgorithm.ComplexCondition, new[] { 1, 2, 3, 4 }));
196196

197197
using (counter.Attach()) {
198198
Assert.That(inlineQuery.Any(), Is.True);
@@ -246,7 +246,7 @@ public async Task InlineQueryInSeparateBatchAsyncTest()
246246

247247
using (counter.Attach()) {
248248
var inlineQuery = await session.Query.All<ALotOfFieldsEntityValid>()
249-
.Where(e => e.Id.In(IncludeAlgorithm.ComplexCondition, new[] { 1, 2 })).AsAsync();
249+
.Where(e => e.Id.In(IncludeAlgorithm.ComplexCondition, new[] { 1, 2, 3, 4 })).AsAsync();
250250
Assert.That(inlineQuery.Any(), Is.True);
251251
Assert.That(counter.Count, Is.EqualTo(6));
252252
}

Orm/Xtensive.Orm/Orm/Providers/CommandProcessing/CommandProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ protected ExecutionBehavior GetCommandExecutionBehavior(ICollection<CommandPart>
131131
}
132132
sum += count;
133133
}
134-
if (sum + currentParametersCount < MaxQueryParameterCount) {
134+
if (sum + currentParametersCount <= MaxQueryParameterCount) {
135135
return ExecutionBehavior.AsOneCommand;
136136
}
137137
return sum < MaxQueryParameterCount

0 commit comments

Comments
 (0)