Skip to content
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

Utilize retryStrategy for connection error #1855

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

nodegin
Copy link

@nodegin nodegin commented Feb 9, 2024

I am hosting my Redis on cloud service which has DDoS prevent mechanism,

Currently I'm using BullMQ as the queue service but it emit tons of request causing my provider throttle my Redis connection.

So I'm getting the following error:

ReplyError: Too many requests. Please try again later.
    at parseError (/Users/user/Desktop/project/node_modules/redis-parser/lib/parser.js:179:12)
    at parseType (/Users/user/Desktop/project/node_modules/redis-parser/lib/parser.js:302:14) {
  command: {
    name: 'auth',
    args: [ 'redis-host', 'password' ]
  }
}

I have added the following to my ioredis connection params:

  reconnectOnError: () => 2 as const,
  retryStrategy(times) {
    const delay = Math.min(times * 50, 2000);
    return delay;
  },

which should fixes the issue, but currently ioredis doesn't utilize retryStrategy for connection event.

So this PR is to provide support for that

@lukas-becker0
Copy link

lukas-becker0 commented Aug 28, 2024

You could open the same PR in the valkey fork of this repo (iovalkey) which seems to be better maintained than this repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants