File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ async function connectRedis() {
12
12
if ( ! REDIS_ENABLED ) {
13
13
console . log ( 'Redis disabled' ) ;
14
14
redisAvailable = false ;
15
+
15
16
return ;
16
17
}
17
18
@@ -38,6 +39,7 @@ async function connectRedis() {
38
39
async function disconnectRedis ( ) {
39
40
if ( ! REDIS_ENABLED ) {
40
41
redisAvailable = false ;
42
+
41
43
return ;
42
44
}
43
45
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ class Controller {
59
59
if ( cached ) {
60
60
res . locals . data = JSON . parse ( cached ) ;
61
61
res . locals . statusCode = HTTP_STATUS . OK ;
62
+
62
63
return next ( ) ;
63
64
}
64
65
@@ -68,11 +69,13 @@ class Controller {
68
69
try {
69
70
await redisClient . set ( cacheKey , JSON . stringify ( result ) , { EX : 300 } ) ;
70
71
} catch {
72
+ console . warn ( 'Redis set failed (ignored)' ) ;
71
73
}
72
74
}
73
75
74
76
res . locals . data = result ;
75
77
res . locals . statusCode = HTTP_STATUS . OK ;
78
+
76
79
return next ( ) ;
77
80
} ;
78
81
Original file line number Diff line number Diff line change @@ -11,9 +11,14 @@ async function startServer() {
11
11
12
12
server . stop = async ( ) => {
13
13
await disconnectRedis ( ) ;
14
- await new Promise ( ( resolve , reject ) => {
14
+
15
+ return new Promise ( ( resolve , reject ) => {
15
16
server . close ( ( err ) => {
16
- if ( err ) return reject ( err ) ;
17
+ if ( err ) {
18
+ reject ( err ) ;
19
+
20
+ return ;
21
+ }
17
22
resolve ( ) ;
18
23
} ) ;
19
24
} ) ;
You can’t perform that action at this time.
0 commit comments