Repository navigation
Fix reactive getEx() ignoring PERSIST/KEEPTTL/EXAT/PXAT (fixes #7308) - #7309
Merged
mrniko merged 1 commit intoAug 21, 2026
Merged
Conversation
fixes redisson#7308 RedissonReactiveStringCommands.getEx() always sent the raw Expiration value as a PX argument regardless of what was requested, since Expiration encodes PERSIST/KEEPTTL as negative sentinel millisecond values and EXAT/PXAT as an absolute epoch timestamp rather than a relative delay. PERSIST/KEEPTTL were rejected by Redis outright, and EXAT/PXAT produced a wildly wrong TTL. Mirrors the fix already applied to the sync counterpart, RedissonConnection.getEx(), in commit 6c393a5, across all 10 Spring Data Redis module variants (2.6 through 4.1) that contain this method. Signed-off-by: 심현민 <[email protected]>
stlahxm
force-pushed
the
fix/reactive-getex-expiration-options
branch
from
August 19, 2026 15:21
8d97825 to
0249042
Compare
Member
|
Thanks for contribution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes
getEx()in all 10RedissonReactiveStringCommands.javamodule variants (Spring Data Redis 2.6 through 4.1) to checkExpiration.isPersistent()/isKeepTtl()/isUnixTimestamp()and translate to the matchingGETEXoption, instead of always sending the raw expiration value asPX.Why
See #7308 for the full writeup. Short version:
ExpirationencodesPERSIST/KEEPTTLas negative sentinel values internally. The current code sends whatevergetExpirationTimeInMilliseconds()returns as a literalPXargument regardless of what was requested, so:Expiration.persistent()→GETEX key PX -1000→ Redis rejects it:ERR invalid expire time in 'getex' commandExpiration.keepTtl()→GETEX key PX -2000→ same errorExpiration.unixTimestamp(...)(EXAT/PXAT) → the absolute epoch value is sent as if it were a relative millisecond delay, landing decades in the future instead of at the intended timeThis exact bug was already fixed on the sync side (
RedissonConnection.getEx()) in commit6c393a51f. This PR applies the identical fix to the reactive counterpart in the same files, which that commit didn't touch.Changes
getEx()inRedissonReactiveStringCommands.java, all 10 module variants that contain this method (redisson-spring-data-{26,27,30,31,32,33,34,35,40,41}):Mirrors the sync fix's logic and option choices exactly (including always using
PXATwith millisecond precision for the absolute-timestamp case, rather than branching betweenEXAT/PXATby original unit).RedissonReactiveStringCommandsTest, added to all 10 module variants, covering all fourExpirationvariants (relative milliseconds,PERSIST,KEEPTTL,EXAT) against a real Redis instance.Test plan
Before the fix, against both
masterand the latest releaseredisson-4.7.0:After the fix, all four pass in every module (
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0each).Backward compatibility
No API or behavior change for the one case that already worked (plain relative expiration).
PERSIST/KEEPTTL/EXAT/PXATgo from "throws" or "silently wrong" to "correct", which can only fix previously-broken behavior, not change any working behavior.