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 1010
1111jobs :
1212 test :
13- name : Node.js ${{ matrix.node }}
13+ name : Node.js ${{ matrix.node }} - Redis ${{ matrix.redis }}
1414 runs-on : ubuntu-latest
1515 strategy :
1616 matrix :
1717 node :
1818 - 16
1919 - 18
2020 - 20
21+ redis :
22+ - 4
23+ - 5
2124 services :
2225 redis :
2326 image : redis
3134 node-version : ${{ matrix.node }}
3235 - name : Install
3336 run : npm install
37+ - name : Install correct redis version
38+ run : npm install redis@${{ matrix.redis }}
3439 - name : Lint
3540 run : npm run lint
3641 - name : Test
Original file line number Diff line number Diff line change @@ -42,10 +42,19 @@ RedisPubSub.prototype.close = function(callback) {
4242} ;
4343
4444RedisPubSub . 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 ;
4958} ;
5059
5160RedisPubSub . prototype . _subscribe = function ( channel , callback ) {
@@ -90,5 +99,15 @@ function connect(client) {
9099
91100var PUBLISH_SCRIPT =
92101 'for i = 2, #ARGV do ' +
93- 'redis.call("publish", ARGV[i], ARGV[1]) ' +
102+ 'redis.call("publish", ARGV[i], ARGV[1]) ' +
94103 '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 11{
22 "name" : " sharedb-redis-pubsub" ,
3- "version" : " 5.0.1 " ,
3+ "version" : " 5.1.0 " ,
44 "description" : " Redis pub/sub adapter adapter for ShareDB" ,
55 "main" : " index.js" ,
66 "dependencies" : {
7- "redis" : " ^4.0.0" ,
7+ "redis" : " ^4.0.0 || ^5.0.0 " ,
88 "sharedb" : " ^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0"
99 },
1010 "devDependencies" : {
You can’t perform that action at this time.
0 commit comments