File tree Expand file tree Collapse file tree 4 files changed +5
-27
lines changed
tests/StackExchange.Redis.Tests Expand file tree Collapse file tree 4 files changed +5
-27
lines changed Original file line number Diff line number Diff line change 1
- using System . Diagnostics . CodeAnalysis ;
1
+ using System . Diagnostics . CodeAnalysis ;
2
2
3
3
namespace StackExchange . Redis ;
4
4
@@ -9,27 +9,11 @@ public partial class ConnectionMultiplexer
9
9
[ MemberNotNull ( nameof ( SocketManager ) ) ]
10
10
private void OnCreateReaderWriter ( ConfigurationOptions configuration )
11
11
{
12
- SocketManager = configuration . SocketManager ?? GetDefaultSocketManager ( ) ;
12
+ SocketManager = configuration . SocketManager ?? SocketManager . Shared ;
13
13
}
14
14
15
15
private void OnCloseReaderWriter ( )
16
16
{
17
17
SocketManager = null ;
18
18
}
19
-
20
- /// <summary>
21
- /// .NET 6.0+ has changes to sync-over-async stalls in the .NET primary thread pool
22
- /// If we're in that environment, by default remove the overhead of our own threadpool
23
- /// This will eliminate some context-switching overhead and better-size threads on both large
24
- /// and small environments, from 16 core machines to single core VMs where the default 10 threads
25
- /// isn't an ideal situation.
26
- /// </summary>
27
- internal static SocketManager GetDefaultSocketManager ( )
28
- {
29
- #if NET6_0_OR_GREATER
30
- return SocketManager . ThreadPool ;
31
- #else
32
- return SocketManager . Shared ;
33
- #endif
34
- }
35
19
}
Original file line number Diff line number Diff line change @@ -855,10 +855,6 @@ private void StartBacklogProcessor()
855
855
{
856
856
_backlogStatus = BacklogStatus . Activating ;
857
857
858
- #if NET6_0_OR_GREATER
859
- // In .NET 6, use the thread pool stall semantics to our advantage and use a lighter-weight Task
860
- Task . Run ( ProcessBacklogAsync ) ;
861
- #else
862
858
// Start the backlog processor; this is a bit unorthodox, as you would *expect* this to just
863
859
// be Task.Run; that would work fine when healthy, but when we're falling on our face, it is
864
860
// 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()
871
867
Name = "StackExchange.Redis Backlog" , // help anyone looking at thread-dumps
872
868
} ;
873
869
thread . Start ( this ) ;
874
- #endif
875
870
}
876
871
else
877
872
{
Original file line number Diff line number Diff line change 2
2
<PropertyGroup >
3
3
<Nullable >enable</Nullable >
4
4
<!-- extend the default lib targets for the main lib; mostly because of "vectors" -->
5
- <!-- Note: we're NOT building for .NET 6 because the thread pool changes are not wins yet -->
6
- <TargetFrameworks >net461;netstandard2.0;net472;netcoreapp3.1;net5.0</TargetFrameworks >
5
+ <TargetFrameworks >net461;netstandard2.0;net472;netcoreapp3.1;net5.0;net6.0</TargetFrameworks >
7
6
<Description >High performance Redis client, incorporating both synchronous and asynchronous usage.</Description >
8
7
<AssemblyName >StackExchange.Redis</AssemblyName >
9
8
<AssemblyTitle >StackExchange.Redis</AssemblyTitle >
35
34
<AdditionalFiles Include =" PublicAPI/PublicAPI.Shipped.txt" />
36
35
<AdditionalFiles Include =" PublicAPI/PublicAPI.Unshipped.txt" />
37
36
<!-- APIs for netcoreapp3.1+ -->
38
- <AdditionalFiles Include =" PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt" Condition =" '$(TargetFramework )' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0 '" />
37
+ <AdditionalFiles Include =" PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt" Condition =" '$(TargetFrameworkIdentifier )' == '.NETCoreApp '" />
39
38
</ItemGroup >
40
39
41
40
<ItemGroup >
Original file line number Diff line number Diff line change @@ -468,7 +468,7 @@ public void DefaultThreadPoolManagerIsDetected()
468
468
469
469
using var conn = ConnectionMultiplexer . Connect ( config ) ;
470
470
471
- Assert . Same ( ConnectionMultiplexer . GetDefaultSocketManager ( ) . Scheduler , conn . SocketManager ? . Scheduler ) ;
471
+ Assert . Same ( SocketManager . Shared . Scheduler , conn . SocketManager ? . Scheduler ) ;
472
472
}
473
473
474
474
[ Theory ]
You can’t perform that action at this time.
0 commit comments