Skip to content

Commit cb87bd8

Browse files
ITikhonovITikhonov
authored andcommitted
fix
1 parent f4a133e commit cb87bd8

2 files changed

Lines changed: 6 additions & 13 deletions

File tree

src/StackExchange.Redis/ReadOnlySequenceExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static bool SequenceEqual(this in ReadOnlySequence<byte> first, ReadOnlyS
8080
other = other.Slice(span.Length);
8181
}
8282

83-
return true;
83+
return other.IsEmpty;
8484
}
8585

8686
public static bool SequenceEqual(this in ReadOnlySequence<byte> first, in ReadOnlySequence<byte> other)

src/StackExchange.Redis/ValueCondition.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -179,20 +179,13 @@ public static ValueCondition CalculateDigest(in ReadOnlySequence<byte> value)
179179

180180
var xxh = _xxh;
181181
xxh ??= _xxh = new XxHash3();
182-
183-
try
182+
xxh.Reset();
183+
foreach (var memory in value)
184184
{
185-
foreach (var memory in value)
186-
{
187-
xxh.Append(memory.Span);
188-
}
189-
var digest = unchecked((long)xxh.GetCurrentHashAsUInt64());
190-
return new ValueCondition(ConditionKind.DigestEquals, digest);
191-
}
192-
finally
193-
{
194-
xxh.Reset();
185+
xxh.Append(memory.Span);
195186
}
187+
var digest = unchecked((long)xxh.GetCurrentHashAsUInt64());
188+
return new ValueCondition(ConditionKind.DigestEquals, digest);
196189
}
197190

198191
/// <summary>

0 commit comments

Comments
 (0)