Browse Source

fix(job-queue-plugin): Fix redis connection to remote hosts

Fixes #1097
Michael Bromley 4 years ago
parent
commit
9e368737bb

+ 1 - 0
packages/job-queue-plugin/src/bullmq/bullmq-job-queue-strategy.ts

@@ -185,6 +185,7 @@ export class BullMQJobQueueStrategy implements InspectableJobQueueStrategy {
             const options: WorkerOptions = {
                 concurrency: DEFAULT_CONCURRENCY,
                 ...this.options.workerOptions,
+                connection: this.options.connection,
             };
             this.worker = new Worker(QUEUE_NAME, this.workerProcessor, options).on('error', (e: any) =>
                 Logger.error(`BullMQ Worker error: ${e.message}`, loggerCtx, e.stack),

+ 1 - 5
packages/job-queue-plugin/src/bullmq/redis-health-indicator.ts

@@ -14,11 +14,7 @@ export class RedisHealthIndicator extends HealthIndicator {
         super();
     }
     async isHealthy(key: string, timeoutMs = 5000): Promise<HealthIndicatorResult> {
-        let connection: RedisConnection;
-        connection = new RedisConnection({
-            ...this.options.connection,
-            connectTimeout: 10000,
-        });
+        const connection = new RedisConnection(this.options.connection);
         const pingResult = await new Promise(async (resolve, reject) => {
             try {
                 connection.on('error', err => {