From a98581670eb15177ad1d04b7aa9a09c2ea0c9135 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Mon, 24 Apr 2017 12:19:22 -0700 Subject: [PATCH] Schedule connection adapter reads on configured thread pool (#1741) * Schedule connection adapter reads on configured thread pool - This should speed up connection adapters as we don't block new reads. It *might* also help some of the test flakiness --- .../Internal/FrameConnection.cs | 2 +- .../PipeOptionsTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/FrameConnection.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/FrameConnection.cs index fef3f1847f..99bf9346d9 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/FrameConnection.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal/FrameConnection.cs @@ -49,7 +49,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal // Internal for testing internal PipeOptions AdaptedInputPipeOptions => new PipeOptions { - ReaderScheduler = InlineScheduler.Default, + ReaderScheduler = _context.ServiceContext.ThreadPool, WriterScheduler = InlineScheduler.Default, MaximumSizeHigh = _context.ServiceContext.ServerOptions.Limits.MaxRequestBufferSize ?? 0, MaximumSizeLow = _context.ServiceContext.ServerOptions.Limits.MaxRequestBufferSize ?? 0 diff --git a/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests/PipeOptionsTests.cs b/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests/PipeOptionsTests.cs index 2b544bd393..56cec36d96 100644 --- a/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests/PipeOptionsTests.cs +++ b/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests/PipeOptionsTests.cs @@ -66,7 +66,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests Assert.Equal(expectedMaximumSizeLow, connectionLifetime.AdaptedInputPipeOptions.MaximumSizeLow); Assert.Equal(expectedMaximumSizeHigh, connectionLifetime.AdaptedInputPipeOptions.MaximumSizeHigh); - Assert.Same(InlineScheduler.Default, connectionLifetime.AdaptedInputPipeOptions.ReaderScheduler); + Assert.Same(serviceContext.ThreadPool, connectionLifetime.AdaptedInputPipeOptions.ReaderScheduler); Assert.Same(InlineScheduler.Default, connectionLifetime.AdaptedInputPipeOptions.WriterScheduler); }