Skip to content

Commit

Permalink
feat: add support for redis+sentinel url
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoPoi committed Feb 8, 2022
1 parent 9acc9b2 commit d48bda6
Show file tree
Hide file tree
Showing 5 changed files with 4,978 additions and 4,875 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM node:10-alpine as build-env

RUN apk --no-cache add git

RUN mkdir -p /src
WORKDIR /src

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"bunyan": "^1.8.12",
"express": "^4.17.1",
"prom-client": "^12.0.0",
"redis-url-plus": "github:FujiBilly/redis-url-plus#feature/billy/support-sentinel-mode",
"tslib": "^2.0.0",
"uuid": "^8.0.0",
"yargs": "^15.1.0"
Expand Down
3 changes: 2 additions & 1 deletion src/metricCollector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as Logger from 'bunyan';
import { EventEmitter } from 'events';
import IoRedis from 'ioredis';
import { register as globalRegister, Registry } from 'prom-client';
import redisUrlPlus from 'redis-url-plus';

import { logger as globalLogger } from './logger';
import { getJobCompleteStats, getStats, makeGuages, QueueGauges } from './queueGauges';
Expand Down Expand Up @@ -56,7 +57,7 @@ export class MetricCollector {
if (_type === 'client') {
return this.defaultRedisClient!;
}
return new IoRedis(this.redisUri, redisOpts);
return new IoRedis(Object.assign(redisUrlPlus(this.redisUri), redisOpts));
}

private addToQueueSet(names: string[]): void {
Expand Down
3 changes: 3 additions & 0 deletions src/redis-url-plus.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module 'redis-url-plus' {
export default function redisUrlPlus(url: string): import('ioredis').RedisOptions;
}
Loading

0 comments on commit d48bda6

Please sign in to comment.