Commit 1dcf55e1 authored by mgravell's avatar mgravell

fix plinq glitch

parent 49f24a2c
......@@ -913,7 +913,7 @@ public override string ToString()
string s = null;
if (_log != null)
{
lock(SyncLock)
lock (SyncLock)
{
s = _log?.ToString();
}
......@@ -2254,7 +2254,7 @@ internal void OnManagedConnectionRestored(object sender, ConnectionFailedEventAr
{
ConnectionMultiplexer connection = (ConnectionMultiplexer)sender;
if(connection.sentinelMasterReconnectTimer != null)
if (connection.sentinelMasterReconnectTimer != null)
{
connection.sentinelMasterReconnectTimer.Dispose();
connection.sentinelMasterReconnectTimer = null;
......@@ -2268,7 +2268,7 @@ internal void OnManagedConnectionRestored(object sender, ConnectionFailedEventAr
{
// Verify that the reconnected endpoint is a master,
// and the correct one otherwise we should reconnect
if(connection.GetServer(e.EndPoint).IsSlave || e.EndPoint != connection.currentSentinelMasterEndPoint)
if (connection.GetServer(e.EndPoint).IsSlave || e.EndPoint != connection.currentSentinelMasterEndPoint)
{
// Wait for things to smooth out
Thread.Sleep(200);
......@@ -2277,7 +2277,7 @@ internal void OnManagedConnectionRestored(object sender, ConnectionFailedEventAr
SwitchMaster(e.EndPoint, connection);
}
}
catch(Exception)
catch (Exception)
{
// If we get here it means that we tried to reconnect to a server that is no longer
// considered a master by Sentinel and was removed from the list of endpoints.
......@@ -2311,7 +2311,11 @@ internal void OnManagedConnectionFailed(object sender, ConnectionFailedEventArgs
.ToArray()
.Where(s => s.ServerType == ServerType.Sentinel)
.AsParallel()
.Select(s => GetServer(s.EndPoint).SentinelGetMasterAddressByName(serviceName))
.Select(s =>
{
try { return GetServer(s.EndPoint).SentinelGetMasterAddressByName(serviceName); }
catch { return null; }
})
.First(r => r != null);
internal EndPoint currentSentinelMasterEndPoint;
......@@ -2388,7 +2392,11 @@ internal void UpdateSentinelAddressList(string serviceName)
.ToArray()
.Where(s => s.ServerType == ServerType.Sentinel)
.AsParallel()
.Select(s => GetServer(s.EndPoint).SentinelGetSentinelAddresses(serviceName))
.Select(s =>
{
try { return GetServer(s.EndPoint).SentinelGetSentinelAddresses(serviceName); }
catch { return null; }
})
.First(r => r != null);
// Ignore errors, as having an updated sentinel list is
......
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