go-redis icon indicating copy to clipboard operation
go-redis copied to clipboard

Calling Brpop on Windows with 0 as the second parameter will cause duplicate requests

Open LemonNekoGH opened this issue 3 years ago • 0 comments

I'm practicing writing queues with redis, but I'm running into the problem mentioned in the title.

Expected Behavior

I used the redis-cli monitor command to see the redis commands that my program called, this is the normal result I get under macOS, and the same when I pass a non-zero value to the second parameter of Brpop result. image And this is normal output of my program. image

Current Behavior

When I run the program on Windows and the parameter passed to Brpop is 0, the output of redis-cli monitor becomes like this. image The output of my program becomes like this. image

Possible Solution

This is the code I see when stepping through it, it seems to re-execute the brpop command for some reason, but in fact the result of the last execution was successful. Maybe it's because the judgment of retry is too brute force? image_2022-07-02_19-33-27

Steps to Reproduce

This is where I wrote the code: https://github.com/LemonNekoGH/simple-queue-practice

Context (Environment)

Go version: 1.18.3 OS: Windows 10 19044.1766 Redis: Running in Docker on the computer above, version 7.0.2

LemonNekoGH avatar Jul 02 '22 13:07 LemonNekoGH