Skip to content

Commit d55434b

Browse files
Fix: Pop operations must use unbounded DeleteExpiredItems
PopMinOrMax and SortedSetPopMinOrMaxCount access sortedSet.Min/Max directly after cleanup. With bounded deletion, expired entries can remain in the sorted set and be returned to clients. Use unbounded deletion for Pop since correctness matters more than latency here. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0f60a43 commit d55434b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

libs/server/Objects/SortedSet/SortedSetObjectImpl.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ private void SortedSetRank(ref ObjectInput input, ref ObjectOutput output, byte
758758
/// <returns>A tuple containing the score and the element as a byte array.</returns>
759759
public (double Score, byte[] Element) PopMinOrMax(bool popMaxScoreElement = false)
760760
{
761-
DeleteExpiredItems(bound: 16);
761+
DeleteExpiredItems();
762762

763763
if (sortedSet.Count == 0)
764764
return default;
@@ -780,7 +780,7 @@ private void SortedSetRank(ref ObjectInput input, ref ObjectOutput output, byte
780780
/// <param name="op"></param>
781781
private void SortedSetPopMinOrMaxCount(ref ObjectInput input, ref ObjectOutput output, byte respProtocolVersion, SortedSetOperation op)
782782
{
783-
DeleteExpiredItems(bound: 16);
783+
DeleteExpiredItems();
784784

785785
var count = input.arg1;
786786
var countDone = 0;

0 commit comments

Comments
 (0)