Skip to content

Commit 98714d4

Browse files
committed
fix initial build errors
1 parent 312dda9 commit 98714d4

File tree

6 files changed

+39
-37
lines changed

6 files changed

+39
-37
lines changed

src/StackExchange.Redis/CommandMap.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public sealed class CommandMap
3131

3232
RedisCommand.BLPOP, RedisCommand.BRPOP, RedisCommand.BRPOPLPUSH, // yeah, me neither!
3333

34-
RedisCommand.PSUBSCRIBE, RedisCommand.PUBLISH, RedisCommand.PUNSUBSCRIBE, RedisCommand.SUBSCRIBE, RedisCommand.UNSUBSCRIBE, RedisCommand.SPUBLISH, RedisCommand.SSUBSCRIBE, RedisCommand.SUNSUBSCRIBE,
34+
RedisCommand.PSUBSCRIBE, RedisCommand.PUBLISH, RedisCommand.PUNSUBSCRIBE, RedisCommand.SUBSCRIBE, RedisCommand.UNSUBSCRIBE, RedisCommand.SPUBLISH, RedisCommand.SSUBSCRIBE, RedisCommand.SUNSUBSCRIBE,
3535

3636
RedisCommand.DISCARD, RedisCommand.EXEC, RedisCommand.MULTI, RedisCommand.UNWATCH, RedisCommand.WATCH,
3737

@@ -57,7 +57,7 @@ public sealed class CommandMap
5757

5858
RedisCommand.BLPOP, RedisCommand.BRPOP, RedisCommand.BRPOPLPUSH, // yeah, me neither!
5959

60-
RedisCommand.PSUBSCRIBE, RedisCommand.PUBLISH, RedisCommand.PUNSUBSCRIBE, RedisCommand.SUBSCRIBE, RedisCommand.UNSUBSCRIBE, RedisCommand.SPUBLISH, RedisCommand.SSUBSCRIBE, RedisCommand.SUNSUBSCRIBE,
60+
RedisCommand.PSUBSCRIBE, RedisCommand.PUBLISH, RedisCommand.PUNSUBSCRIBE, RedisCommand.SUBSCRIBE, RedisCommand.UNSUBSCRIBE, RedisCommand.SPUBLISH, RedisCommand.SSUBSCRIBE, RedisCommand.SUNSUBSCRIBE,
6161

6262
RedisCommand.DISCARD, RedisCommand.EXEC, RedisCommand.MULTI, RedisCommand.UNWATCH, RedisCommand.WATCH,
6363

src/StackExchange.Redis/PhysicalConnection.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ public void RecordConnectionFailed(
384384
bool isInitialConnect = false,
385385
IDuplexPipe? connectingPipe = null)
386386
{
387-
bool weAskedForThis = false;
387+
bool weAskedForThis;
388388
Exception? outerException = innerException;
389389
IdentifyFailureType(innerException, ref failureType);
390390
var bridge = BridgeCouldBeNull;
@@ -1669,10 +1669,13 @@ private void MatchResult(in RawResult result)
16691669

16701670
// invoke the handlers
16711671
RedisChannel channel;
1672-
if (items[0].IsEqual(message)) {
1672+
if (items[0].IsEqual(message))
1673+
{
16731674
channel = items[1].AsRedisChannel(ChannelPrefix, RedisChannel.RedisChannelOptions.None);
16741675
Trace("MESSAGE: " + channel);
1675-
} else {
1676+
}
1677+
else
1678+
{
16761679
channel = items[1].AsRedisChannel(ChannelPrefix, RedisChannel.RedisChannelOptions.Sharded);
16771680
Trace("SMESSAGE: " + channel);
16781681
}

src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,9 +1315,7 @@ StackExchange.Redis.RedisChannel.PatternMode.Auto = 0 -> StackExchange.Redis.Red
13151315
StackExchange.Redis.RedisChannel.PatternMode.Literal = 1 -> StackExchange.Redis.RedisChannel.PatternMode
13161316
StackExchange.Redis.RedisChannel.PatternMode.Pattern = 2 -> StackExchange.Redis.RedisChannel.PatternMode
13171317
StackExchange.Redis.RedisChannel.RedisChannel() -> void
1318-
StackExchange.Redis.RedisChannel.RedisChannel(byte[]? value, bool isSharded) -> void
13191318
StackExchange.Redis.RedisChannel.RedisChannel(byte[]? value, StackExchange.Redis.RedisChannel.PatternMode mode) -> void
1320-
StackExchange.Redis.RedisChannel.RedisChannel(string! value, bool isSharded) -> void
13211319
StackExchange.Redis.RedisChannel.RedisChannel(string! value, StackExchange.Redis.RedisChannel.PatternMode mode) -> void
13221320
StackExchange.Redis.RedisCommandException
13231321
StackExchange.Redis.RedisCommandException.RedisCommandException(string! message) -> void

src/StackExchange.Redis/RedisChannel.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace StackExchange.Redis
99
public readonly struct RedisChannel : IEquatable<RedisChannel>
1010
{
1111
internal readonly byte[]? Value;
12-
12+
1313
internal readonly RedisChannelOptions Options;
1414

1515
[Flags]
@@ -33,15 +33,10 @@ internal enum RedisChannelOptions
3333
public bool IsPattern => (Options & RedisChannelOptions.Pattern) != 0;
3434

3535
/// <summary>
36-
/// Indicates whether this channel represents a shard channel (see <c>SSUBSCRIBE</c>)
36+
/// Indicates whether this channel represents a shard channel (see <c>SSUBSCRIBE</c>).
3737
/// </summary>
3838
public bool IsSharded => (Options & RedisChannelOptions.Sharded) != 0;
3939

40-
/// <summary>
41-
/// Indicates whether this channel represents a shard channel (see <c>SSUBSCRIBE</c>)
42-
/// </summary>
43-
public bool IsSharded => _isSharded;
44-
4540
internal bool IsNull => Value == null;
4641

4742
/// <summary>
@@ -80,14 +75,18 @@ public static bool UseImplicitAutoPattern
8075
/// </summary>
8176
/// <param name="value">The name of the channel to create.</param>
8277
/// <param name="mode">The mode for name matching.</param>
83-
public RedisChannel(byte[]? value, PatternMode mode) : this(value, DeterminePatternBased(value, mode) ? RedisChannelOptions.Pattern : RedisChannelOptions.None) { }
78+
public RedisChannel(byte[]? value, PatternMode mode) : this(value, DeterminePatternBased(value, mode) ? RedisChannelOptions.Pattern : RedisChannelOptions.None)
79+
{
80+
}
8481

8582
/// <summary>
8683
/// Create a new redis channel from a string, explicitly controlling the pattern mode.
8784
/// </summary>
8885
/// <param name="value">The string name of the channel to create.</param>
8986
/// <param name="mode">The mode for name matching.</param>
90-
public RedisChannel(string value, PatternMode mode) : this(value is null ? null : Encoding.UTF8.GetBytes(value), mode) { }
87+
public RedisChannel(string value, PatternMode mode) : this(value is null ? null : Encoding.UTF8.GetBytes(value), mode)
88+
{
89+
}
9190

9291
/// <summary>
9392
/// Create a new redis channel from a buffer, representing a sharded channel.
@@ -319,4 +318,4 @@ public static implicit operator RedisChannel(byte[]? key)
319318
private RedisChannel(byte[]? value) => throw new NotSupportedException();
320319
#endif
321320
}
322-
}
321+
}

src/StackExchange.Redis/ResultProcessor.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,7 @@ public bool TryParse(in RawResult result, out TimeSpan? expiry)
354354
switch (result.Resp2TypeBulkString)
355355
{
356356
case ResultType.Integer:
357-
long time;
358-
if (result.TryGetInt64(out time))
357+
if (result.TryGetInt64(out long time))
359358
{
360359
if (time < 0)
361360
{
@@ -470,7 +469,7 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
470469
var newServer = message.Command switch
471470
{
472471
RedisCommand.SUBSCRIBE or RedisCommand.SSUBSCRIBE or RedisCommand.PSUBSCRIBE => connection.BridgeCouldBeNull?.ServerEndPoint,
473-
_ => null
472+
_ => null,
474473
};
475474
Subscription?.SetCurrentServer(newServer);
476475
return true;
@@ -1253,17 +1252,15 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
12531252
switch (result.Resp2TypeBulkString)
12541253
{
12551254
case ResultType.Integer:
1256-
long i64;
1257-
if (result.TryGetInt64(out i64))
1255+
if (result.TryGetInt64(out long i64))
12581256
{
12591257
SetResult(message, i64);
12601258
return true;
12611259
}
12621260
break;
12631261
case ResultType.SimpleString:
12641262
case ResultType.BulkString:
1265-
double val;
1266-
if (result.TryGetDouble(out val))
1263+
if (result.TryGetDouble(out double val))
12671264
{
12681265
SetResult(message, val);
12691266
return true;
@@ -1366,8 +1363,7 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
13661363
case ResultType.Integer:
13671364
case ResultType.SimpleString:
13681365
case ResultType.BulkString:
1369-
long i64;
1370-
if (result.TryGetInt64(out i64))
1366+
if (result.TryGetInt64(out long i64))
13711367
{
13721368
SetResult(message, i64);
13731369
return true;
@@ -1423,8 +1419,7 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
14231419
SetResult(message, null);
14241420
return true;
14251421
}
1426-
double val;
1427-
if (result.TryGetDouble(out val))
1422+
if (result.TryGetDouble(out double val))
14281423
{
14291424
SetResult(message, val);
14301425
return true;
@@ -1449,8 +1444,7 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
14491444
SetResult(message, null);
14501445
return true;
14511446
}
1452-
long i64;
1453-
if (result.TryGetInt64(out i64))
1447+
if (result.TryGetInt64(out long i64))
14541448
{
14551449
SetResult(message, i64);
14561450
return true;
@@ -2167,7 +2161,10 @@ private sealed class RedisStreamInterleavedProcessor : ValuePairInterleavedProce
21672161
protected override bool AllowJaggedPairs => false; // we only use this on a flattened map
21682162

21692163
public static readonly RedisStreamInterleavedProcessor Instance = new();
2170-
private RedisStreamInterleavedProcessor() { }
2164+
private RedisStreamInterleavedProcessor()
2165+
{
2166+
}
2167+
21712168
protected override RedisStream Parse(in RawResult first, in RawResult second, object? state)
21722169
=> new(key: first.AsRedisKey(), entries: ((MultiStreamProcessor)state!).ParseRedisStreamEntries(second));
21732170
}
@@ -2549,7 +2546,10 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
25492546
internal class StreamNameValueEntryProcessor : ValuePairInterleavedProcessorBase<NameValueEntry>
25502547
{
25512548
public static readonly StreamNameValueEntryProcessor Instance = new();
2552-
private StreamNameValueEntryProcessor() { }
2549+
private StreamNameValueEntryProcessor()
2550+
{
2551+
}
2552+
25532553
protected override NameValueEntry Parse(in RawResult first, in RawResult second, object? state)
25542554
=> new NameValueEntry(first.AsRedisValue(), second.AsRedisValue());
25552555
}

tests/StackExchange.Redis.Tests/ClusterTests.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
using StackExchange.Redis.Profiling;
2-
using System;
1+
using System;
32
using System.Collections.Generic;
43
using System.IO;
54
using System.Linq;
65
using System.Net;
76
using System.Threading;
87
using System.Threading.Tasks;
8+
using StackExchange.Redis.Profiling;
99
using Xunit;
1010
using Xunit.Abstractions;
1111

@@ -15,7 +15,9 @@ namespace StackExchange.Redis.Tests;
1515
[Collection(SharedConnectionFixture.Key)]
1616
public class ClusterTests : TestBase
1717
{
18-
public ClusterTests(ITestOutputHelper output, SharedConnectionFixture fixture) : base(output, fixture) { }
18+
public ClusterTests(ITestOutputHelper output, SharedConnectionFixture fixture) : base(output, fixture)
19+
{
20+
}
1921

2022
protected override string GetConfiguration() => TestConfig.Current.ClusterServersAndPorts + ",connectTimeout=10000";
2123

@@ -747,7 +749,6 @@ public void ConnectIncludesSubscriber()
747749
}
748750
}
749751

750-
751752
[Theory]
752753
[InlineData(true)]
753754
[InlineData(false)]
@@ -762,7 +763,8 @@ public async Task ClusterPubSub(bool sharded)
762763
List<(RedisChannel, RedisValue)> received = new();
763764
var queue = await pubsub.SubscribeAsync(channel);
764765
_ = Task.Run(async () =>
765-
{ // use queue API to have control over order
766+
{
767+
// use queue API to have control over order
766768
await foreach (var item in queue)
767769
{
768770
lock (received)

0 commit comments

Comments
 (0)