Skip to content

refactor: decouple Transaction from Jedis - #4440

Merged
ggivo merged 5 commits into
masterfrom
topic/ggivo/decople-transactions-from-jedis
Mar 20, 2026
Merged

ggivo merged 5 commits into
masterfrom
topic/ggivo/decople-transactions-from-jedis

Conversation

@ggivo

@ggivo ggivo commented Feb 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Removes direct Jedis reference from Transaction class to reduce coupling.

Changes

  • Added protected hook methods onAfterExec() and onAfterDiscard() in Transaction
  • Jedis.multi() now creates an anonymous subclass that overrides these hooks to call resetState()
  • Removed Jedis field from Transaction

Testing

Verified by TransactionCommandsTest βœ…


Note

Medium Risk
Changes transaction lifecycle cleanup by moving Jedis.resetState() to hook callbacks, which could affect connection/state handling after EXEC/DISCARD if any edge cases rely on the old direct reference.

Overview
Decouples Transaction from Jedis while preserving state cleanup behavior. Transaction no longer stores a Jedis reference; instead it exposes protected hooks onAfterExec() and onAfterDiscard() that run in the finally blocks of exec()/discard().

Jedis.multi() now creates a Transaction backed by getConnection() and overrides those hooks to call resetState(), keeping legacy Jedis state reset semantics without tight coupling.

Written by Cursor Bugbot for commit cc1fe6f. This will update automatically on new commits. Configure here.

Remove direct Jedis reference from Transaction class by introducing
protected hook methods onAfterExec() and onAfterDiscard(). Jedis now
creates an anonymous Transaction subclass that overrides these hooks
to invoke resetState().
@ggivo ggivo added this to the 7.4.0 milestone Feb 20, 2026
@ggivo ggivo added the techdebt Things that can be improved or refactored label Feb 20, 2026
@github-actions

github-actions Bot commented Feb 20, 2026 •

Copy link
Copy Markdown

Test Results

β€‡β€‡β€ˆ308 files  Β±0β€‚β€ƒβ€‡β€‡β€ˆ308 suites  Β±0   11m 39s ⏱️ -6s
11β€ˆ136 tests Β±0  10β€ˆ921 βœ…  -β€Š159  215 πŸ’€ +159  0 ❌ Β±0 
 5β€ˆ851 runsβ€Š Β±0   5β€ˆ784 βœ…  -β€Šβ€‡58   67 πŸ’€ + 58  0 ❌ Β±0 

Results for commit cc1fe6f. ± Comparison against base commit ae4ed55.

This pull request skips 159 tests.
redis.clients.jedis.commands.jedis.ClusterHotkeysCommandsTest ‑ hotkeysGetNotSupportedInCluster
redis.clients.jedis.commands.jedis.ClusterHotkeysCommandsTest ‑ hotkeysResetNotSupportedInCluster
redis.clients.jedis.commands.jedis.ClusterHotkeysCommandsTest ‑ hotkeysStartNotSupportedInCluster
redis.clients.jedis.commands.jedis.ClusterHotkeysCommandsTest ‑ hotkeysStopNotSupportedInCluster
redis.clients.jedis.commands.jedis.ClusterHotkeysCommandsTest ‑ hotkeysWithSlotsOnSingleClusterNode
redis.clients.jedis.commands.jedis.HotkeysCommandsTest[1] ‑ hotkeysBothMetrics
redis.clients.jedis.commands.jedis.HotkeysCommandsTest[1] ‑ hotkeysDurationOption
redis.clients.jedis.commands.jedis.HotkeysCommandsTest[1] ‑ hotkeysGetBeforeStart
redis.clients.jedis.commands.jedis.HotkeysCommandsTest[1] ‑ hotkeysLifecycle
redis.clients.jedis.commands.jedis.HotkeysCommandsTest[1] ‑ hotkeysResponseFields
…

♻️ This comment has been updated with latest results.

@ggivo ggivo self-assigned this Feb 20, 2026

@atakavci atakavci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
lets label it as breaking.

@ggivo ggivo added the breakingchange Pull request that has breaking changes. Must include the breaking behavior in release notes. label Feb 24, 2026
@ggivo ggivo modified the milestones: 7.4.0, 8.0.0 Feb 24, 2026
@jit-ci

jit-ci Bot commented Mar 16, 2026 •

Copy link
Copy Markdown

πŸ›‘οΈ Jit Security Scan Results

CRITICAL HIGH MEDIUM

βœ… No security findings were detected in this PR


Security scan by Jit

@ggivo
ggivo merged commit 8ba734c into master Mar 20, 2026
23 checks passed
@ggivo
ggivo deleted the topic/ggivo/decople-transactions-from-jedis branch March 24, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breakingchange Pull request that has breaking changes. Must include the breaking behavior in release notes. techdebt Things that can be improved or refactored

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants