diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index 2bfa07809..cf44a985d 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -8,6 +8,7 @@ Current package versions: ## Unreleased +- Change: Target net6.0 instead of net5.0, since net5.0 is end of life. ([#2497 by eerhardt](https://github.com/StackExchange/StackExchange.Redis/pull/2497)) - Fix: Fix nullability annotation of IConnectionMultiplexer.RegisterProfiler ([#2494 by eerhardt](https://github.com/StackExchange/StackExchange.Redis/pull/2494)) ## 2.6.116 diff --git a/src/StackExchange.Redis/ConnectionMultiplexer.ReaderWriter.cs b/src/StackExchange.Redis/ConnectionMultiplexer.ReaderWriter.cs index b9ae3a15a..a30da7865 100644 --- a/src/StackExchange.Redis/ConnectionMultiplexer.ReaderWriter.cs +++ b/src/StackExchange.Redis/ConnectionMultiplexer.ReaderWriter.cs @@ -1,4 +1,4 @@ -using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.CodeAnalysis; namespace StackExchange.Redis; @@ -9,27 +9,11 @@ public partial class ConnectionMultiplexer [MemberNotNull(nameof(SocketManager))] private void OnCreateReaderWriter(ConfigurationOptions configuration) { - SocketManager = configuration.SocketManager ?? GetDefaultSocketManager(); + SocketManager = configuration.SocketManager ?? SocketManager.Shared; } private void OnCloseReaderWriter() { SocketManager = null; } - - /// - /// .NET 6.0+ has changes to sync-over-async stalls in the .NET primary thread pool - /// If we're in that environment, by default remove the overhead of our own threadpool - /// This will eliminate some context-switching overhead and better-size threads on both large - /// and small environments, from 16 core machines to single core VMs where the default 10 threads - /// isn't an ideal situation. - /// - internal static SocketManager GetDefaultSocketManager() - { -#if NET6_0_OR_GREATER - return SocketManager.ThreadPool; -#else - return SocketManager.Shared; -#endif - } } diff --git a/src/StackExchange.Redis/PhysicalBridge.cs b/src/StackExchange.Redis/PhysicalBridge.cs index b42c40a19..f211cae61 100644 --- a/src/StackExchange.Redis/PhysicalBridge.cs +++ b/src/StackExchange.Redis/PhysicalBridge.cs @@ -855,10 +855,6 @@ private void StartBacklogProcessor() { _backlogStatus = BacklogStatus.Activating; -#if NET6_0_OR_GREATER - // In .NET 6, use the thread pool stall semantics to our advantage and use a lighter-weight Task - Task.Run(ProcessBacklogAsync); -#else // Start the backlog processor; this is a bit unorthodox, as you would *expect* this to just // be Task.Run; that would work fine when healthy, but when we're falling on our face, it is // easy to get into a thread-pool-starvation "spiral of death" if we rely on the thread-pool @@ -871,7 +867,6 @@ private void StartBacklogProcessor() Name = "StackExchange.Redis Backlog", // help anyone looking at thread-dumps }; thread.Start(this); -#endif } else { diff --git a/src/StackExchange.Redis/StackExchange.Redis.csproj b/src/StackExchange.Redis/StackExchange.Redis.csproj index 4a8b28f92..b0e2a93ff 100644 --- a/src/StackExchange.Redis/StackExchange.Redis.csproj +++ b/src/StackExchange.Redis/StackExchange.Redis.csproj @@ -2,8 +2,7 @@ enable - - net461;netstandard2.0;net472;netcoreapp3.1;net5.0 + net461;netstandard2.0;net472;netcoreapp3.1;net6.0 High performance Redis client, incorporating both synchronous and asynchronous usage. StackExchange.Redis StackExchange.Redis @@ -35,7 +34,7 @@ - + diff --git a/tests/StackExchange.Redis.Tests/ConfigTests.cs b/tests/StackExchange.Redis.Tests/ConfigTests.cs index b11c968cf..f5a2764c7 100644 --- a/tests/StackExchange.Redis.Tests/ConfigTests.cs +++ b/tests/StackExchange.Redis.Tests/ConfigTests.cs @@ -468,7 +468,7 @@ public void DefaultThreadPoolManagerIsDetected() using var conn = ConnectionMultiplexer.Connect(config); - Assert.Same(ConnectionMultiplexer.GetDefaultSocketManager().Scheduler, conn.SocketManager?.Scheduler); + Assert.Same(SocketManager.Shared.Scheduler, conn.SocketManager?.Scheduler); } [Theory]