Skip to content

Commit e1d6a62

Browse files
committed
💥 Bump redis version to 5.0.0
Redis released [version 5](https://github.com/redis/node-redis/releases/tag/redis%405.0.0) , but the only breaking change that is affecting us is: ``` Connection Management: client.QUIT/quit() is replaced by client.close() client.disconnect() has been renamed to client.destroy() ``` I tried to make it a non breakable change, by allowing both close and quit
1 parent 819b549 commit e1d6a62

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

‎.github/workflows/test.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@ on:
1010

1111
jobs:
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+
- 22
22+
- 24
23+
redis:
24+
- 4
25+
- 5
2126
services:
2227
redis:
2328
image: redis
@@ -31,6 +36,8 @@ jobs:
3136
node-version: ${{ matrix.node }}
3237
- name: Install
3338
run: npm install
39+
- name: Install correct redis version
40+
run: npm install redis@${{ matrix.redis }}
3441
- name: Lint
3542
run: npm run lint
3643
- name: Test

‎index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ RedisPubSub.prototype.close = function(callback) {
4343

4444
RedisPubSub.prototype._close = function() {
4545
return this._closing = this._closing || this._connect().then(Promise.all([
46-
this.client.quit(),
47-
this.observer.quit()
46+
close(this.client),
47+
close(this.observer)
4848
]));
4949
};
5050

@@ -92,3 +92,11 @@ var PUBLISH_SCRIPT =
9292
'for i = 2, #ARGV do ' +
9393
'redis.call("publish", ARGV[i], ARGV[1]) ' +
9494
'end';
95+
96+
function close(client) {
97+
if(client.close) {
98+
return client.close()
99+
}
100+
101+
return client.quit()
102+
}

‎package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "sharedb-redis-pubsub",
3-
"version": "5.0.1",
3+
"version": "5.0.2",
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": {

0 commit comments

Comments
 (0)