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() {
1212 if ( ! REDIS_ENABLED ) {
1313 console . log ( 'Redis disabled' ) ;
1414 redisAvailable = false ;
15+
1516 return ;
1617 }
1718
@@ -38,6 +39,7 @@ async function connectRedis() {
3839async function disconnectRedis ( ) {
3940 if ( ! REDIS_ENABLED ) {
4041 redisAvailable = false ;
42+
4143 return ;
4244 }
4345
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ class Controller {
5959 if ( cached ) {
6060 res . locals . data = JSON . parse ( cached ) ;
6161 res . locals . statusCode = HTTP_STATUS . OK ;
62+
6263 return next ( ) ;
6364 }
6465
@@ -68,11 +69,13 @@ class Controller {
6869 try {
6970 await redisClient . set ( cacheKey , JSON . stringify ( result ) , { EX : 300 } ) ;
7071 } catch {
72+ console . warn ( 'Redis set failed (ignored)' ) ;
7173 }
7274 }
7375
7476 res . locals . data = result ;
7577 res . locals . statusCode = HTTP_STATUS . OK ;
78+
7679 return next ( ) ;
7780 } ;
7881
Original file line number Diff line number Diff line change @@ -11,9 +11,14 @@ async function startServer() {
1111
1212 server . stop = async ( ) => {
1313 await disconnectRedis ( ) ;
14- await new Promise ( ( resolve , reject ) => {
14+
15+ return new Promise ( ( resolve , reject ) => {
1516 server . close ( ( err ) => {
16- if ( err ) return reject ( err ) ;
17+ if ( err ) {
18+ reject ( err ) ;
19+
20+ return ;
21+ }
1722 resolve ( ) ;
1823 } ) ;
1924 } ) ;
You can’t perform that action at this time.
0 commit comments