steve0511 / resty-redis-cluster

Openresty lua client for redis cluster.
Apache License 2.0
376 stars 134 forks source link

fix commit_pipeline connect err not refresh_slots,when it has auth #93

Closed shuishui3 closed 2 years ago

shuishui3 commented 2 years ago

hi,We had a problem recently,when a cluster shuts down several nodes,we found that the project did not refresh the node,After checking, we found that in the commit_pipeline method

            local ok, err = redis_client:connect(ip, port, self.config.connect_opts)
            local authok, autherr = check_auth(self, redis_client)
            if autherr then
                return nil, autherr
            end
            if slave then
                --set readonly
                local ok, err = redis_client:readonly()
                if not ok then
                    self:refresh_slots()
                    return nil, err
                end
            end
            if ok then
                   redis_client:init_pipeline()

The if ok then should be in redis_client:connect behind,I think

toredash commented 2 years ago

Nice catch @shuishui3, LGTM

steve0511 commented 2 years ago

thanks for catching