redis/go-redis

[Bug] The connection object returned by the redis instance call Conn() method loses the Hook

ppanphper opened this issue · 1 comments

Issue tracker is used for reporting bugs and discussing new features. Please use
stackoverflow for supporting issues.

Expected Behavior

trigger custom hook ProcessHook

Current Behavior

Unable to trigger custom hook ProcessHook

Possible Solution

Inherit the hook chain of the redis instance

Steps to Reproduce

  1. client = redis.NewClient(opts.Simple())
  2. client.AddHook(&CustomHook{redis: r})
  3. stickyConn := client.Conn()
  4. stickyConn.Get(ctx, "test").Err()

Context (Environment)

go 1.23
redis v9.6.1

Detailed Description

There is no hook chain that inherits the redis instance

Image

Image

Possible Implementation

Inherit the hook chain of the redis instance

Hello @ppanphper thank you for reaching out. I will review this and report back to you.