-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v2.5 work: .NET 6.0: add build defaulting to the thread pool #1939
Changes from all commits
e60579d
9248250
20c82e5
0c3a02b
00f3ab3
d8e15fa
3100a2a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,36 @@ | ||
namespace StackExchange.Redis | ||
using System; | ||
|
||
namespace StackExchange.Redis | ||
{ | ||
public partial class ConnectionMultiplexer | ||
{ | ||
internal SocketManager SocketManager { get; private set; } | ||
|
||
partial void OnCreateReaderWriter(ConfigurationOptions configuration) | ||
{ | ||
SocketManager = configuration.SocketManager ?? SocketManager.Shared; | ||
SocketManager = configuration.SocketManager ?? GetDefaultSocketManager(); | ||
} | ||
|
||
partial void OnCloseReaderWriter() | ||
{ | ||
SocketManager = null; | ||
} | ||
partial void OnWriterCreated(); | ||
|
||
/// <summary> | ||
/// .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. | ||
/// </summary> | ||
internal static SocketManager GetDefaultSocketManager() | ||
{ | ||
#if NET6_0_OR_GREATER | ||
return SocketManager.ThreadPool; | ||
#else | ||
return SocketManager.Shared; | ||
#endif | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -361,14 +361,7 @@ public static ConnectionMultiplexer CreateDefault( | |
} | ||
|
||
public static string Me([CallerFilePath] string filePath = null, [CallerMemberName] string caller = null) => | ||
#if NET472 | ||
"net472-" | ||
#elif NETCOREAPP3_1 | ||
"netcoreapp3.1-" | ||
#else | ||
"unknown-" | ||
#endif | ||
+ Path.GetFileNameWithoutExtension(filePath) + "-" + caller; | ||
Environment.Version.ToString() + Path.GetFileNameWithoutExtension(filePath) + "-" + caller; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't a 1:1 replacement, but the goal is to simple make it unique per version - let's go simpler and never update this with TFMs again. |
||
|
||
protected static TimeSpan RunConcurrent(Action work, int threads, int timeout = 10000, [CallerMemberName] string caller = null) | ||
{ | ||
|
@@ -417,7 +410,9 @@ void callback() | |
for (int i = 0; i < threads; i++) | ||
{ | ||
var thd = threadArr[i]; | ||
#if !NET6_0_OR_GREATER | ||
if (thd.IsAlive) thd.Abort(); | ||
#endif | ||
} | ||
throw new TimeoutException(); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "2.2", | ||
"version": "2.5-prerelease", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: this change also exists in #1912 - whichever lands first wins the v2.5-prelease versioning kick. |
||
"versionHeightOffset": -1, | ||
"assemblyVersion": "2.0", | ||
"publicReleaseRefSpec": [ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this isn't related, but is an intermittent test failure (unrelated to this PR at all) under load due to the minimal wait for publish observations vs. over large tests. Sneaking a fix in here.