From a2de263588be0e2ff7ab20a15f5011200eeacedb Mon Sep 17 00:00:00 2001 From: Nedyalko Dyakov Date: Fri, 27 Jun 2025 01:53:56 +0300 Subject: [PATCH] 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. --- tx.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tx.go b/tx.go index 0daa222e..67689f57 100644 --- a/tx.go +++ b/tx.go @@ -24,9 +24,10 @@ type Tx struct { func (c *Client) newTx() *Tx { tx := Tx{ baseClient: baseClient{ - opt: c.opt, - connPool: pool.NewStickyConnPool(c.connPool), - hooksMixin: c.hooksMixin.clone(), + opt: c.opt, + connPool: pool.NewStickyConnPool(c.connPool), + hooksMixin: c.hooksMixin.clone(), + pushProcessor: c.pushProcessor, // Copy push processor from parent client }, } tx.init()