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

feat(core): Add compatibility to redis > 6 ACLs system using username in queue-mode #5048

Merged
merged 2 commits into from
Jan 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 5 additions & 24 deletions packages/cli/src/Queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { IExecuteResponsePromiseData } from 'n8n-workflow';
import config from '@/config';
import * as ActiveExecutions from '@/ActiveExecutions';
import * as WebhookHelpers from '@/WebhookHelpers';
import { RedisOptions } from 'ioredis';

export type Job = Bull.Job<JobData>;
export type JobQueue = Bull.Queue<JobData>;
Expand All @@ -30,29 +29,11 @@ export class Queue {

async init() {
const prefix = config.getEnv('queue.bull.prefix');
const redisHost = config.getEnv('queue.bull.redis.host');
const redisUsername = config.getEnv('queue.bull.redis.username');
const redisPassword = config.getEnv('queue.bull.redis.password');
const redisPort = config.getEnv('queue.bull.redis.port');
const redisDB = config.getEnv('queue.bull.redis.db');
// retro-compatibility with redis < 6
// prepare new redis options setting in order to define only set values
const redisOptions: RedisOptions = {};
if (redisHost) {
redisOptions.host = redisHost;
}
if (redisUsername) {
redisOptions.username = redisUsername;
}
if (redisPassword) {
redisOptions.password = redisPassword;
}
if (redisPort) {
redisOptions.port = redisPort;
}
if (redisDB) {
redisOptions.db = redisDB;
}
const redisOptions: RedisOptions = config.getEnv('queue.bull.redis');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @netroy
With this commit, you remove my modifications: when the variable QUEUE_BULL_REDIS_USERNAME is not set, it will send username: ''
Is this going to be a problem ?

Copy link
Member

@netroy netroy Jan 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't seem to be an issue when I tested it on redis 5 and 6.


// eslint-disable-next-line @typescript-eslint/naming-convention
const { default: Bull } = await import('bull');

// Disabling ready check is necessary as it allows worker to
// quickly reconnect to Redis if Redis crashes or is unreachable
// for some time. With it enabled, worker might take minutes to realize
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.