Skip to content

Commit

Permalink
Add TODO comment in zslUpdateScore
Browse files Browse the repository at this point in the history
about edge cases: allowing score to be equal to pref or next node and also compare ele in these cases.

Signed-off-by: Viktor Söderqvist <[email protected]>
  • Loading branch information
zuiderkwast authored Jan 8, 2025
1 parent c8e1ba7 commit 8316c90
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/t_zset.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,9 @@ static void zslDelete(zskiplist *zsl, zskiplistNode *node) {
static zskiplistNode *zslUpdateScore(zskiplist *zsl, zskiplistNode *node, double newscore) {
/* If the node, after the score update, would be still exactly
* at the same position, we can just update the score without
* actually removing and re-inserting the element in the skiplist. */
* actually removing and re-inserting the element in the skiplist.
* (TODO: The check can be extended to check also equality of the
* score, but then we'll also need to compare the key order). */
if ((node->backward == NULL || node->backward->score < newscore) &&
(node->level[0].forward == NULL || node->level[0].forward->score > newscore)) {
node->score = newscore;
Expand Down

0 comments on commit 8316c90

Please sign in to comment.