File tree Expand file tree Collapse file tree 3 files changed +32
-8
lines changed Expand file tree Collapse file tree 3 files changed +32
-8
lines changed Original file line number Diff line number Diff line change 10
10
11
11
jobs :
12
12
test :
13
- name : Node.js ${{ matrix.node }}
13
+ name : Node.js ${{ matrix.node }} - Redis ${{ matrix.redis }}
14
14
runs-on : ubuntu-latest
15
15
strategy :
16
16
matrix :
17
17
node :
18
18
- 16
19
19
- 18
20
20
- 20
21
+ redis :
22
+ - 4
23
+ - 5
21
24
services :
22
25
redis :
23
26
image : redis
31
34
node-version : ${{ matrix.node }}
32
35
- name : Install
33
36
run : npm install
37
+ - name : Install correct redis version
38
+ run : npm install redis@${{ matrix.redis }}
34
39
- name : Lint
35
40
run : npm run lint
36
41
- name : Test
Original file line number Diff line number Diff line change @@ -42,10 +42,19 @@ RedisPubSub.prototype.close = function(callback) {
42
42
} ;
43
43
44
44
RedisPubSub . prototype . _close = function ( ) {
45
- return this . _closing = this . _closing || this . _connect ( ) . then ( Promise . all ( [
46
- this . client . quit ( ) ,
47
- this . observer . quit ( )
48
- ] ) ) ;
45
+ var pubsub = this ;
46
+
47
+ if ( ! this . _closing ) {
48
+ this . _closing = this . _connect ( )
49
+ . then ( function ( ) {
50
+ return Promise . all ( [
51
+ close ( pubsub . client ) ,
52
+ close ( pubsub . observer )
53
+ ] ) ;
54
+ } ) ;
55
+ }
56
+
57
+ return this . _closing ;
49
58
} ;
50
59
51
60
RedisPubSub . prototype . _subscribe = function ( channel , callback ) {
@@ -90,5 +99,15 @@ function connect(client) {
90
99
91
100
var PUBLISH_SCRIPT =
92
101
'for i = 2, #ARGV do ' +
93
- 'redis.call("publish", ARGV[i], ARGV[1]) ' +
102
+ 'redis.call("publish", ARGV[i], ARGV[1]) ' +
94
103
'end' ;
104
+
105
+ function close ( client ) {
106
+ if ( client . close ) {
107
+ return client . close ( ) ;
108
+ }
109
+
110
+ // The quit is deprecated for node redis >= 5.0.0
111
+ // This call should be removed after we stop supporting redis < 5.0.0
112
+ return client . quit ( ) ;
113
+ }
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " sharedb-redis-pubsub" ,
3
- "version" : " 5.0.1 " ,
3
+ "version" : " 5.1.0 " ,
4
4
"description" : " Redis pub/sub adapter adapter for ShareDB" ,
5
5
"main" : " index.js" ,
6
6
"dependencies" : {
7
- "redis" : " ^4.0.0" ,
7
+ "redis" : " ^4.0.0 || ^5.0.0 " ,
8
8
"sharedb" : " ^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0"
9
9
},
10
10
"devDependencies" : {
You can’t perform that action at this time.
0 commit comments