File tree 2 files changed +13
-14
lines changed
2 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,9 @@ export class QueueManager {
28
28
} ;
29
29
30
30
constructor ( queueName : QueueNameType , options ?: QueueOptions ) {
31
+ const redisUrl = this . getRedisURL ( ) ;
31
32
const defaultOptions : QueueOptions = { } ;
32
- this . queue = new Queue < QueueJobData > ( queueName , config . REDIS_URL , {
33
+ this . queue = new Queue < QueueJobData > ( queueName , redisUrl , {
33
34
...defaultOptions ,
34
35
...options ,
35
36
} ) ;
@@ -47,6 +48,16 @@ export class QueueManager {
47
48
} ) ;
48
49
}
49
50
51
+ private getRedisURL ( ) : string {
52
+ const hasQueryParams = config . REDIS_URL . includes ( "?" ) ;
53
+
54
+ if ( config . REDIS_URL . includes ( "rediss" ) ) {
55
+ return hasQueryParams ? `${ config . REDIS_URL } &tls=true` : `${ config . REDIS_URL } ?tls=true` ;
56
+ }
57
+
58
+ return config . REDIS_URL ;
59
+ }
60
+
50
61
public static getInstance ( queueName : QueueNameType ) {
51
62
if ( ! QueueManager . instance ) {
52
63
QueueManager . instance = new QueueManager ( queueName ) ;
Original file line number Diff line number Diff line change @@ -11,9 +11,7 @@ export class RedisClient {
11
11
return ;
12
12
}
13
13
14
- const redisUrl = this . getRedisURL ( ) ;
15
-
16
- this . client = new Redis ( redisUrl , {
14
+ this . client = new Redis ( config . REDIS_URL , {
17
15
reconnectOnError : ( err ) => {
18
16
const targetError = "READONLY" ;
19
17
if ( err . message . includes ( targetError ) ) {
@@ -32,16 +30,6 @@ export class RedisClient {
32
30
} ) ;
33
31
}
34
32
35
- private getRedisURL ( ) : string {
36
- const hasQueryParams = config . REDIS_URL . includes ( "?" ) ;
37
-
38
- if ( config . REDIS_URL . includes ( "rediss" ) ) {
39
- return hasQueryParams ? `${ config . REDIS_URL } &tls=true` : `${ config . REDIS_URL } ?tls=true` ;
40
- }
41
-
42
- return config . REDIS_URL ;
43
- }
44
-
45
33
public static getInstance ( ) : RedisClient {
46
34
if ( ! RedisClient . instance ) {
47
35
RedisClient . instance = new RedisClient ( ) ;
You can’t perform that action at this time.
0 commit comments