Skip to content

[Feature Request] Redis retry_strategy #5387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dplewis opened this issue Feb 22, 2019 · 3 comments · Fixed by #5584
Closed

[Feature Request] Redis retry_strategy #5387

dplewis opened this issue Feb 22, 2019 · 3 comments · Fixed by #5584
Labels
type:feature New feature or improvement of existing feature

Comments

@dplewis
Copy link
Member

dplewis commented Feb 22, 2019

Is your feature request related to a problem? Please describe.

If a redis server goes down the server will go down.

Describe the solution you'd like

Should auto connect based on number of attempts or timeout

Additional context

The redis node package already has this feature, here is an example taken from their docs.

var client = redis.createClient({
    retry_strategy: function (options) {
        if (options.error && options.error.code === 'ECONNREFUSED') {
            // End reconnecting on a specific error and flush all commands with
            // a individual error
            return new Error('The server refused the connection');
        }
        if (options.total_retry_time > 1000 * 60 * 60) {
            // End reconnecting after a specific timeout and flush all commands
            // with a individual error
            return new Error('Retry time exhausted');
        }
        if (options.attempt > 10) {
            // End reconnecting with built in error
            return undefined;
        }
        // reconnect after
        return Math.min(options.attempt * 100, 3000);
    }
});
@oleg-koval
Copy link

are you looking for smth like redis exponential backoff?

@georgesjamous
Copy link
Contributor

@dplewis
doesn't configuring Redis with retry_strategy achieve the expected result?

@dplewis
Copy link
Member Author

dplewis commented May 11, 2019

@georgesjamous RedisAdapter yes, but not for LiveQuery. I submitted a PR to make this configurable. Also check your email.

dplewis added a commit that referenced this issue May 12, 2019
UnderratedDev pushed a commit to UnderratedDev/parse-server that referenced this issue Mar 21, 2020
@mtrezza mtrezza added type:feature New feature or improvement of existing feature and removed type:improvement labels Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or improvement of existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants