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

fix(docs): update PATTERNS.md - redis config needs 2 params since bull v4 #2721

Merged
merged 1 commit into from Apr 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions PATTERNS.md
Expand Up @@ -69,11 +69,16 @@ Reusing Redis Connections
A standard queue requires **3 connections** to the Redis server. In some situations you might want to re-use connections—for example on Heroku where the connection count is restricted. You can do this with the `createClient` option in the `Queue` constructor:

```js
var {REDIS_URL} = process.env
var REDIS_CONFIG = {
host: '127.0.0.1',
port: '6379',
maxRetriesPerRequest: null, // Since bull v4
enableReadyCheck: false // Since bull v4
};

var Redis = require('ioredis')
var client = new Redis(REDIS_URL);
var subscriber = new Redis(REDIS_URL);
var client = new Redis(REDIS_CONFIG);
var subscriber = new Redis(REDIS_CONFIG);

var opts = {
createClient: function (type) {
Expand All @@ -83,7 +88,7 @@ var opts = {
case 'subscriber':
return subscriber;
default:
return new Redis(REDIS_URL);
return new Redis(REDIS_CONFIG);
}
}
}
Expand Down