monitor command breaks due to ReadTimeout
stlava opened this issue · 0 comments
stlava commented
Expected Behavior
Monitor command should work.
Current Behavior
If you do not set a large ReadTimeout
on the client when using the monitor command then the socket timeout is hit but that error is never propagated back in any way so the channel listener is left in a blocked state.
Possible Solution
Either:
- Update docs to inform users that they are responsible for detecting timeouts when listening to the channel
- A
ReadTimeout
(or any other error) should be propagated back to user via closing the monitor channel
Steps to Reproduce
- Start client
client := redis.NewClient(&redis.Options{
Addr: "127.0.0.1:6379",
// ReadTimeout: 1 * time.Minute,
})
stream := make(chan string, 1000)
monitorCmd := client.Monitor(ctx, stream)
monitorCmd.Start()
for {
var msg string
select {
case <-ctx.Done():
fmt.Println("ctx done")
case msg = <-stream:
fmt.Println("message")
}
fmt.Println(msg)
}
- Wait a second and then via cli perform any redis operation
- Check output from client