Grokzen / redis-py-cluster

Python cluster client for the official redis cluster. Redis 3.0+.
https://redis-py-cluster.readthedocs.io/
MIT License
1.1k stars 316 forks source link

Fix reading from replicas in pipelined commands #471

Open FranGM opened 3 years ago

FranGM commented 3 years ago

We fail to send the READONLY command to replicas when running commands inside a pipeline, which results in an increased latency as the server will respond with an unneeded MOVED message forcing us to retry the command.

We move the sending of the READONLY command to the connection creation itself, since at that point we already know if we're connecting to a replica or not, so we can ensure consistency on sending this command.

Fixes https://github.com/Grokzen/redis-py-cluster/issues/470