@@ -14,7 +14,11 @@ namespace Xtensive.Orm.Providers
14
14
{
15
15
internal sealed class SimpleCommandProcessor : CommandProcessor , ISqlTaskProcessor
16
16
{
17
- private Queue < SqlTask > tasks = new ( ) ;
17
+ // equals to default batch size from SessionConfiguration
18
+ // hard to choose particular value so let it be some known number :)
19
+ private const int DefaultTaskQueueCapacity = 25 ;
20
+
21
+ private Queue < SqlTask > tasks = new ( DefaultTaskQueueCapacity ) ;
18
22
19
23
void ISqlTaskProcessor . ProcessTask ( SqlLoadTask task , CommandProcessorContext context )
20
24
{
@@ -52,7 +56,7 @@ void ISqlTaskProcessor.ProcessTask(SqlPersistTask task, CommandProcessorContext
52
56
public override void ExecuteTasks ( CommandProcessorContext context )
53
57
{
54
58
context . ProcessingTasks = tasks ;
55
- tasks = new Queue < SqlTask > ( ) ;
59
+ tasks = new Queue < SqlTask > ( DefaultTaskQueueCapacity ) ;
56
60
57
61
while ( context . ProcessingTasks . Count > 0 ) {
58
62
AllocateCommand ( context ) ;
@@ -80,7 +84,7 @@ public override void ExecuteTasks(CommandProcessorContext context)
80
84
public override async Task ExecuteTasksAsync ( CommandProcessorContext context , CancellationToken token )
81
85
{
82
86
context . ProcessingTasks = tasks ;
83
- tasks = new Queue < SqlTask > ( ) ;
87
+ tasks = new Queue < SqlTask > ( DefaultTaskQueueCapacity ) ;
84
88
85
89
while ( context . ProcessingTasks . Count > 0 ) {
86
90
AllocateCommand ( context ) ;
0 commit comments