File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -4,13 +4,13 @@ const configRedis = require('../config/redis');
4
4
class CheckCompletion {
5
5
constructor ( ) {
6
6
this . options = {
7
- host : configRedis . auxRedisHost ,
8
- port : configRedis . auxRedisPort ,
7
+ host : configRedis . auxRedisHost ,
8
+ port : configRedis . auxRedisPort ,
9
9
} ;
10
10
}
11
11
12
12
async increment (
13
- key
13
+ key ,
14
14
) {
15
15
const redis = new Redis (
16
16
this . options ,
@@ -24,22 +24,22 @@ class CheckCompletion {
24
24
}
25
25
26
26
async decrement (
27
- key
27
+ key ,
28
28
) {
29
29
const redis = new Redis (
30
30
this . options ,
31
31
) ;
32
32
const luaScript = `
33
- local count = redis.call('DECR', KEYS[1])
34
- return count
33
+ local count = redis.call('DECR', KEYS[1])
34
+ return count
35
35
` ;
36
36
37
37
const result = await redis . eval ( luaScript , 1 , key ) ;
38
38
if ( result === 0 ) {
39
- console . log ( 'Last job completed.' ) ;
40
- await redis . del ( key ) ;
39
+ console . log ( 'Last job completed.' ) ;
40
+ await redis . del ( key ) ;
41
41
} else {
42
- console . log ( `Jobs remaining: ${ result } ` ) ;
42
+ console . log ( `Jobs remaining: ${ result } ` ) ;
43
43
}
44
44
return result ;
45
45
}
You can’t perform that action at this time.
0 commit comments