Skip to content

monitor command breaks due to ReadTimeout #3079

Open
@stlava

Description

@stlava

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:

  1. Update docs to inform users that they are responsible for detecting timeouts when listening to the channel
  2. A ReadTimeout (or any other error) should be propagated back to user via closing the monitor channel

Steps to Reproduce

  1. 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)
	}
  1. Wait a second and then via cli perform any redis operation
  2. Check output from client

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions