Skip to content

Fix queue head operations of reversed RedisList view - #3459

Closed
CCCLL wants to merge 1 commit into
spring-projects:mainfrom
CCCLL:reversed-list-head-operations
Closed

CCCLL wants to merge 1 commit into
spring-projects:mainfrom
CCCLL:reversed-list-head-operations

Conversation

@CCCLL

@CCCLL CCCLL commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Closes #3458

ReversedRedisListView delegated peek(), poll() and poll(long, TimeUnit) to the tail of the view (peekLast()/pollLast()), although Deque defines them as equivalent to peekFirst()/pollFirst(). poll(long, TimeUnit) also dropped its arguments and called pollLast(0, TimeUnit.SECONDS), so a timed poll on an empty list sent BLPOP key 0 and did not return after the timeout.

This change delegates the three methods to peekFirst(), pollFirst() and pollFirst(timeout, unit), in line with how take() already delegates to takeFirst(). element(), pop(), remove() and drainTo(…) build on them and are fixed as well.

Unit tests cover the delegation including the timeout, integration tests cover the behavior against Redis. All new tests fail on main and pass with the fix. The support.collections tests pass against Redis 8.6.2 with Lettuce and Jedis.

`ReversedRedisListView` delegated `peek()`, `poll()` and `poll(long, TimeUnit)` to the tail of the view although `Deque` defines them as head operations. `poll(long, TimeUnit)` also replaced the given timeout with zero, which blocks on an empty list instead of returning after the timeout. `element()`, `pop()`, `remove()` and `drainTo(…)` build on these methods and now use the head of the view as well.

Closes spring-projects#3458

Signed-off-by: Jialin Chen <cccll2019@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 11, 2026
@mp911de mp911de added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 12, 2026
mhalbritter pushed a commit that referenced this pull request Oct 12, 2026
Closes #3458
Original pull request: #3459

Signed-off-by: Jialin Chen <cccll2019@gmail.com>
mhalbritter added a commit that referenced this pull request Oct 12, 2026
@mhalbritter mhalbritter added this to the 4.0.8 (2025.1.8) milestone Oct 12, 2026
@mhalbritter

Copy link
Copy Markdown
Contributor

Thanks @CCCLL ! Merged and backported.

mhalbritter pushed a commit that referenced this pull request Oct 12, 2026
Closes #3458
Original pull request: #3459

Signed-off-by: Jialin Chen <cccll2019@gmail.com>
mhalbritter added a commit that referenced this pull request Oct 12, 2026
mhalbritter pushed a commit that referenced this pull request Oct 12, 2026
Closes #3458
Original pull request: #3459

Signed-off-by: Jialin Chen <cccll2019@gmail.com>
mhalbritter added a commit that referenced this pull request Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RedisList.reversed() view polls and peeks at the wrong end and ignores the poll timeout

4 participants