Skip to content

Redis Cluster Options Not Added on Initialization #25

@renzosunico

Description

@renzosunico

Package version

2.0.7

Node.js and npm version

Node: 12.13.1
NPM: 6.12.1

Sample Code (to reproduce the issue)

In RedisFactory:, when we initialize an IoRedis.Cluster the other parameters such as scaleReads is not passed as second parameter. Instead, only redisOptions is passed as stated in the IORedis documentation.

  _newConnection () {
    if (this._useCluster) {
      debug('creating new redis cluster using config: %j', this._config)
      return new IoRedis.Cluster(this._config.clusters, { redisOptions: this._config.redisOptions })
    }
    debug('creating new redis connection using config: %j', this._config)
    return new IoRedis(this._config)
  }

I have directly modified it on my node_modules as a quick test and it worked for me.

  _newConnection () {
    if (this._useCluster) {
      debug('creating new redis cluster using config: %j', this._config)
      return new IoRedis.Cluster(this._config.clusters, { scaleReads: "all", redisOptions: this._config.redisOptions })
    }
    debug('creating new redis connection using config: %j', this._config)
    return new IoRedis(this._config)
  }

As seen on this metric, all replicas are receiving traffic after I added the scaleReads option.
image

As a side note, any chance we can jump to a newer version of IORedis?

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