Commit 624dd042 authored by Marc Gravell's avatar Marc Gravell

name the socket manager in BookSleeveTestBase; fix bug in...

name the socket manager in BookSleeveTestBase; fix bug in AbandonPendingBacklog; compensate for Me() changes in AsyncTasksReportFailureIfServerUnavailable
parent 96a116b7
...@@ -36,7 +36,7 @@ public void AsyncTasksReportFailureIfServerUnavailable() ...@@ -36,7 +36,7 @@ public void AsyncTasksReportFailureIfServerUnavailable()
Assert.True(c.IsFaulted, "faulted"); Assert.True(c.IsFaulted, "faulted");
var ex = c.Exception.InnerExceptions.Single(); var ex = c.Exception.InnerExceptions.Single();
Assert.IsType<RedisConnectionException>(ex); Assert.IsType<RedisConnectionException>(ex);
Assert.StartsWith("No connection is available to service this operation: SADD AsyncTasksReportFailureIfServerUnavailable", ex.Message); Assert.StartsWith("No connection is available to service this operation: SADD " + key.ToString(), ex.Message);
} }
} }
#endif #endif
......
...@@ -27,7 +27,7 @@ static BookSleeveTestBase() ...@@ -27,7 +27,7 @@ static BookSleeveTestBase()
public static string CreateUniqueName() => Guid.NewGuid().ToString("N"); public static string CreateUniqueName() => Guid.NewGuid().ToString("N");
internal static IServer GetServer(ConnectionMultiplexer conn) => conn.GetServer(conn.GetEndPoints()[0]); internal static IServer GetServer(ConnectionMultiplexer conn) => conn.GetServer(conn.GetEndPoints()[0]);
private static readonly SocketManager socketManager = new SocketManager(); private static readonly SocketManager socketManager = new SocketManager(nameof(BookSleeveTestBase));
internal static ConnectionMultiplexer GetRemoteConnection(bool open = true, bool allowAdmin = false, bool waitForOpen = false, int syncTimeout = 5000, int ioTimeout = 5000) internal static ConnectionMultiplexer GetRemoteConnection(bool open = true, bool allowAdmin = false, bool waitForOpen = false, int syncTimeout = 5000, int ioTimeout = 5000)
{ {
......
...@@ -199,7 +199,8 @@ protected IServer GetAnyMaster(ConnectionMultiplexer muxer) ...@@ -199,7 +199,8 @@ protected IServer GetAnyMaster(ConnectionMultiplexer muxer)
int? connectTimeout = null, string password = null, string tieBreaker = null, TextWriter log = null, int? connectTimeout = null, string password = null, string tieBreaker = null, TextWriter log = null,
bool fail = true, string[] disabledCommands = null, string[] enabledCommands = null, bool fail = true, string[] disabledCommands = null, string[] enabledCommands = null,
bool checkConnect = true, bool pause = true, string failMessage = null, bool checkConnect = true, bool pause = true, string failMessage = null,
string channelPrefix = null, bool useSharedSocketManager = true, Proxy? proxy = null) string channelPrefix = null, bool useSharedSocketManager = true, Proxy? proxy = null,
[CallerMemberName] string caller = null)
{ {
if (pause) Thread.Sleep(250); // get a lot of glitches when hammering new socket creations etc; pace it out a bit if (pause) Thread.Sleep(250); // get a lot of glitches when hammering new socket creations etc; pace it out a bit
string configuration = GetConfiguration(); string configuration = GetConfiguration();
...@@ -223,6 +224,7 @@ protected IServer GetAnyMaster(ConnectionMultiplexer muxer) ...@@ -223,6 +224,7 @@ protected IServer GetAnyMaster(ConnectionMultiplexer muxer)
if (tieBreaker != null) config.TieBreaker = tieBreaker; if (tieBreaker != null) config.TieBreaker = tieBreaker;
if (password != null) config.Password = string.IsNullOrEmpty(password) ? null : password; if (password != null) config.Password = string.IsNullOrEmpty(password) ? null : password;
if (clientName != null) config.ClientName = clientName; if (clientName != null) config.ClientName = clientName;
else if (caller != null) config.ClientName = caller;
if (syncTimeout != null) config.SyncTimeout = syncTimeout.Value; if (syncTimeout != null) config.SyncTimeout = syncTimeout.Value;
if (allowAdmin != null) config.AllowAdmin = allowAdmin.Value; if (allowAdmin != null) config.AllowAdmin = allowAdmin.Value;
if (keepAlive != null) config.KeepAlive = keepAlive.Value; if (keepAlive != null) config.KeepAlive = keepAlive.Value;
......
...@@ -328,7 +328,7 @@ void WritePendingBacklog(PhysicalConnection connection) ...@@ -328,7 +328,7 @@ void WritePendingBacklog(PhysicalConnection connection)
do do
{ {
next = DequeueNextPendingBacklog(); next = DequeueNextPendingBacklog();
WriteMessageDirect(connection, next); if(next != null) WriteMessageDirect(connection, next);
} while (next != null); } while (next != null);
} }
} }
...@@ -338,7 +338,7 @@ void AbandonPendingBacklog(Exception ex) ...@@ -338,7 +338,7 @@ void AbandonPendingBacklog(Exception ex)
do do
{ {
next = DequeueNextPendingBacklog(); next = DequeueNextPendingBacklog();
next.Cancel(ex); next?.Cancel(ex);
} while (next != null); } while (next != null);
} }
internal void OnFullyEstablished(PhysicalConnection connection) internal void OnFullyEstablished(PhysicalConnection connection)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment