redis / redis/node-redis

retry_strategy never called after disconnect?

Open
#1,524 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
17.6k
Forks
2k
Avg merge
2d 3h
Merged PRs (30d)
40

Description

There seems to be an issue with retry_strategy when the client loses the redis connection.

Example:

const redis = redis_lib.createClient({
    "url": "redis://" + config.IP,
    retry_strategy: function (options) {
        console.log("Called");
        return 200;
    }
});
  • If the IP is bad, and can never connects to redis, the function is called, and reconnects attempts happen every 200ms as expected.
  • If the IP is good, it connects to redis, but after the connection drops, this function is not called, instead some default logic takes place, where the reconnect intervals grows exponentially.
    (ex: 3, 6, 12, etc)
Environment

node --version
v10.21.0

redis-server --version
Redis server v=6.0.5 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=35e65e7214deffbe

lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the two cases described: an unreachable Redis server and a connection that drops after succeeding. Trace how retry_strategy is handled during initial connection versus post-disconnect reconnects, then verify that the configured 200ms behavior is used after a drop and that tests cover both paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, redis
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.