Skip to content

Commit 2e5923b

Browse files
committed
Misc cleanup (including line endings for some)
1 parent d5fff16 commit 2e5923b

File tree

10 files changed

+4988
-4987
lines changed

10 files changed

+4988
-4987
lines changed

StackExchange.Redis.Tests/TestBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected void OnInternalError(object sender, InternalErrorEventArgs e)
103103
}
104104

105105
private int privateFailCount;
106-
private static AsyncLocal<int> sharedFailCount = new AsyncLocal<int>();
106+
private static readonly AsyncLocal<int> sharedFailCount = new AsyncLocal<int>();
107107
private volatile int expectedFailCount;
108108

109109
private readonly List<string> privateExceptions = new List<string>();

StackExchange.Redis/StackExchange/Redis/ClusterConfiguration.cs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ public static bool TryParse(string range, out SlotRange value)
9797
/// <param name="other">The other slot range to compare to.</param>
9898
public int CompareTo(SlotRange other)
9999
{
100-
int delta = (int)this.from - (int)other.from;
101-
return delta == 0 ? (int)this.to - (int)other.to : delta;
100+
int delta = (int)from - (int)other.from;
101+
return delta == 0 ? (int)to - (int)other.to : delta;
102102
}
103103

104104
/// <summary>
@@ -161,7 +161,7 @@ internal ClusterConfiguration(ServerSelectionStrategy serverSelectionStrategy, s
161161
{
162162
// Beware: Any exception thrown here will wreak silent havoc like inability to connect to cluster nodes or non returning calls
163163
this.serverSelectionStrategy = serverSelectionStrategy;
164-
this.Origin = origin;
164+
Origin = origin;
165165
using (var reader = new StringReader(nodes))
166166
{
167167
string line;
@@ -178,7 +178,7 @@ internal ClusterConfiguration(ServerSelectionStrategy serverSelectionStrategy, s
178178
// make sure that things like clusterConfiguration[clusterConfiguration.Origin]
179179
// will work as expected.
180180
if (node.IsMyself)
181-
this.Origin = node.EndPoint;
181+
Origin = node.EndPoint;
182182

183183
if (nodeLookup.ContainsKey(node.EndPoint))
184184
{
@@ -286,7 +286,7 @@ internal ClusterNode(ClusterConfiguration configuration, string raw, EndPoint or
286286
{
287287
// https://redis.io/commands/cluster-nodes
288288
this.configuration = configuration;
289-
this.Raw = raw;
289+
Raw = raw;
290290
var parts = raw.Split(StringSplits.Space);
291291

292292
var flags = parts[2].Split(StringSplits.Comma);
@@ -319,8 +319,7 @@ internal ClusterNode(ClusterConfiguration configuration, string raw, EndPoint or
319319
{
320320
if (SlotRange.TryParse(parts[i], out SlotRange range))
321321
{
322-
if (slots == null) slots = new List<SlotRange>(parts.Length - i);
323-
slots.Add(range);
322+
(slots ?? (slots = new List<SlotRange>(parts.Length - i))).Add(range);
324323
}
325324
}
326325
Slots = slots?.AsReadOnly() ?? NoSlots;
@@ -338,10 +337,9 @@ public IList<ClusterNode> Children
338337
List<ClusterNode> nodes = null;
339338
foreach (var node in configuration.Nodes)
340339
{
341-
if (node.ParentNodeId == this.NodeId)
340+
if (node.ParentNodeId == NodeId)
342341
{
343-
if (nodes == null) nodes = new List<ClusterNode>();
344-
nodes.Add(node);
342+
(nodes ?? (nodes = new List<ClusterNode>())).Add(node);
345343
}
346344
}
347345
children = nodes?.AsReadOnly() ?? NoNodes;
@@ -416,14 +414,14 @@ public int CompareTo(ClusterNode other)
416414
{
417415
if (other == null) return -1;
418416

419-
if (this.IsSlave != other.IsSlave) return IsSlave ? 1 : -1; // masters first
417+
if (IsSlave != other.IsSlave) return IsSlave ? 1 : -1; // masters first
420418

421419
if (IsSlave) // both slaves? compare by parent, so we get masters A, B, C and then slaves of A, B, C
422420
{
423-
int i = string.CompareOrdinal(this.ParentNodeId, other.ParentNodeId);
421+
int i = string.CompareOrdinal(ParentNodeId, other.ParentNodeId);
424422
if (i != 0) return i;
425423
}
426-
return string.CompareOrdinal(this.NodeId, other.NodeId);
424+
return string.CompareOrdinal(NodeId, other.NodeId);
427425
}
428426

429427
/// <summary>

StackExchange.Redis/StackExchange/Redis/Condition.cs

Lines changed: 114 additions & 110 deletions
Large diffs are not rendered by default.

StackExchange.Redis/StackExchange/Redis/ConnectionMultiplexer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ internal static string TryGetAzureRoleInstanceIdNoThrow()
9898
var currentRoleInstanceId = currentRoleInstanceProp.GetValue(null, null);
9999
roleInstanceId = currentRoleInstanceId.GetType().GetProperty("Id").GetValue(currentRoleInstanceId, null).ToString();
100100

101-
if (String.IsNullOrEmpty(roleInstanceId))
101+
if (string.IsNullOrEmpty(roleInstanceId))
102102
{
103103
roleInstanceId = null;
104104
}
@@ -2050,7 +2050,7 @@ void add(string lk, string sk, string v)
20502050

20512051
add("Client-Name", "clientName", ClientName);
20522052
add("Server-Endpoint", "serverEndpoint", server.EndPoint.ToString());
2053-
var hashSlot = message.GetHashSlot(this.ServerSelectionStrategy);
2053+
var hashSlot = message.GetHashSlot(ServerSelectionStrategy);
20542054
// only add keyslot if its a valid cluster key slot
20552055
if (hashSlot != ServerSelectionStrategy.NoSlot)
20562056
{

0 commit comments

Comments
 (0)