mirror of
https://github.com/redis/go-redis.git
synced 2025-07-19 11:43:14 +03:00
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.
This commit is contained in:
1
tx.go
1
tx.go
@ -27,6 +27,7 @@ func (c *Client) newTx() *Tx {
|
|||||||
opt: c.opt,
|
opt: c.opt,
|
||||||
connPool: pool.NewStickyConnPool(c.connPool),
|
connPool: pool.NewStickyConnPool(c.connPool),
|
||||||
hooksMixin: c.hooksMixin.clone(),
|
hooksMixin: c.hooksMixin.clone(),
|
||||||
|
pushProcessor: c.pushProcessor, // Copy push processor from parent client
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
tx.init()
|
tx.init()
|
||||||
|
Reference in New Issue
Block a user