Skip to content

Redis could not be reconnected on Linux, but could work on Mac. #1417

@KevinMcSun

Description

@KevinMcSun

Version: 2.7.1
Code:

       redis.createClient(redisUrl, {
        connect_timeout: 60 * 1000,
        retry_strategy: function (options) {
          if (options.error && options.error.code === 'ECONNREFUSED') {
            return new Error('The server refused the connection');
          }
          if (options.total_retry_time > 1000 * 60) {
            return new Error('Retry time exhausted');
          }
          if (options.attempt > 10) {
            return undefined;
          }
          return 60000;
        }
      })

I just expect that the node redis could detect the disconnection in 1 mins and reconnect to redis server in given time successfully when the redis server is ready, but this code dose not work on my Linux env (Ubuntu 18.04), it could work on my Mac env, so could any experts give some help?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions