redis / go-redis

Redis Go client
https://redis.uptrace.dev
BSD 2-Clause "Simplified" License
19.89k stars 2.34k forks source link

Execute "COMMAND" command only when readonly #2815

Closed ofekshenawa closed 9 months ago

ofekshenawa commented 9 months ago

Whenever a new client connection is established, the client has been excessively sending a "COMMAND" command, even when it's not necessary. I've made a modification so that the "COMMAND" command will only be executed when the ReadOnly attribute in ClusterOptions is set to True.

The ReadOnly attribute enables the execution of read-only commands on slave nodes. This change ensures that the "COMMAND" command is used more efficiently and only when required.

ofekshenawa commented 9 months ago

@monkey92t, @vmihailenco, would one of you be able to review this, please?