Skip to content

Commit a2de263

Browse files
committed
fix: copy push notification processor to transaction baseClient
- Copy pushProcessor from parent client to transaction in newTx() - Ensure transactions inherit push notification processor from parent client - Prevent nil pointer dereference in transaction contexts (Watch, Unwatch, etc.) - Maintain consistent push notification behavior across all Redis operations This fixes the panic that was occurring in transaction examples where the transaction's baseClient had a nil pushProcessor field, causing segmentation violations during transaction operations like Watch and Unwatch.
1 parent d1d4529 commit a2de263

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tx.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ type Tx struct {
2424
func (c *Client) newTx() *Tx {
2525
tx := Tx{
2626
baseClient: baseClient{
27-
opt: c.opt,
28-
connPool: pool.NewStickyConnPool(c.connPool),
29-
hooksMixin: c.hooksMixin.clone(),
27+
opt: c.opt,
28+
connPool: pool.NewStickyConnPool(c.connPool),
29+
hooksMixin: c.hooksMixin.clone(),
30+
pushProcessor: c.pushProcessor, // Copy push processor from parent client
3031
},
3132
}
3233
tx.init()

0 commit comments

Comments
 (0)