Skip to content

Commit 93e5dc8

Browse files
authored
Merge pull request #1120 from casperisfine/redis-rb-5.0
Start redis-rb 5.0
2 parents 6b5dfe4 + 418e872 commit 93e5dc8

File tree

108 files changed

+1699
-5668
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+1699
-5668
lines changed

.github/workflows/test.yaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Set up Ruby
1919
uses: ruby/setup-ruby@v1
2020
with:
21-
ruby-version: "2.4"
21+
ruby-version: "2.5"
2222
- name: Set up Gems
2323
run: |
2424
gem update --system --no-document
@@ -33,7 +33,7 @@ jobs:
3333
strategy:
3434
fail-fast: false
3535
matrix:
36-
ruby: ["3.1", "3.0", "2.7", "2.6", "2.5", "2.4", "jruby-9.3.6.0"]
36+
ruby: ["3.1", "3.0", "2.7", "2.6", "2.5", "jruby-9.3.6.0"]
3737
runs-on: ubuntu-latest
3838
env:
3939
VERBOSE: "true"
@@ -73,7 +73,7 @@ jobs:
7373
strategy:
7474
fail-fast: false
7575
matrix:
76-
driver: ["hiredis", "synchrony"]
76+
driver: ["hiredis"]
7777
runs-on: ubuntu-latest
7878
env:
7979
VERBOSE: "true"
@@ -93,7 +93,7 @@ jobs:
9393
- name: Set up Ruby
9494
uses: ruby/setup-ruby@v1
9595
with:
96-
ruby-version: "2.4"
96+
ruby-version: "2.5"
9797
bundler-cache: true
9898
- name: Cache local temporary directory
9999
uses: actions/cache@v3
@@ -133,7 +133,7 @@ jobs:
133133
- name: Set up Ruby
134134
uses: ruby/setup-ruby@v1
135135
with:
136-
ruby-version: "2.4"
136+
ruby-version: "2.5"
137137
bundler-cache: true
138138
- name: Cache local temporary directory
139139
uses: actions/cache@v3
@@ -171,15 +171,15 @@ jobs:
171171
- name: Set up Ruby
172172
uses: ruby/setup-ruby@v1
173173
with:
174-
ruby-version: "2.4"
174+
ruby-version: "2.5"
175175
bundler-cache: true
176176
- name: Cache local temporary directory
177177
uses: actions/cache@v3
178178
with:
179179
path: tmp
180180
key: "local-tmp-redis-7.0-on-ubuntu-latest"
181181
- name: Booting up Redis
182-
run: make start_all
182+
run: make start_sentinel wait_for_sentinel
183183
- name: Test
184184
run: bundle exec rake test:sentinel
185185
- name: Shutting down Redis
@@ -197,6 +197,7 @@ jobs:
197197
LOW_TIMEOUT: "0.14"
198198
DRIVER: ruby
199199
REDIS_BRANCH: "7.0"
200+
REDIS_CLUSTER: "true"
200201
steps:
201202
- name: Check out code
202203
uses: actions/checkout@v3
@@ -209,15 +210,15 @@ jobs:
209210
- name: Set up Ruby
210211
uses: ruby/setup-ruby@v1
211212
with:
212-
ruby-version: "2.4"
213+
ruby-version: "2.7"
213214
bundler-cache: true
214215
- name: Cache local temporary directory
215216
uses: actions/cache@v3
216217
with:
217218
path: tmp
218219
key: "local-tmp-redis-7.0-on-ubuntu-latest"
219220
- name: Booting up Redis
220-
run: make start_all
221+
run: make start start_cluster create_cluster
221222
- name: Test
222223
run: bundle exec rake test:cluster
223224
- name: Shutting down Redis

.rubocop.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
inherit_from: .rubocop_todo.yml
22

33
AllCops:
4-
TargetRubyVersion: 2.4
4+
TargetRubyVersion: 2.5
55

66
Layout/LineLength:
77
Max: 120
@@ -139,6 +139,12 @@ Metrics/BlockNesting:
139139
Style/HashTransformValues:
140140
Enabled: false
141141

142+
Style/TrailingCommaInHashLiteral:
143+
Enabled: false
144+
142145
Style/SymbolProc:
143146
Exclude:
144-
- 'test/**/*'
147+
- 'test/**/*'
148+
149+
Bundler/OrderedGems:
150+
Enabled: false

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Unreleased
22

3+
# Unreleased 5.0.0
4+
5+
- `select` no longer record the current database. If the client has to reconnect after `select` was used, it will reconnect to the original database.
6+
- Removed `logger` option.
7+
- Removed `reconnect_delay_max` and `reconnect_delay`, you can pass precise sleep durations to `reconnect_attempts` instead.
8+
- Require Ruby 2.5+.
9+
- Removed the deprecated `queue` and `commit` methods. Use `pipelined` instead.
10+
- Removed the deprecated `Redis::Future#==`.
11+
- Removed the deprecated `pipelined` and `multi` signature. Commands now MUST be called on the block argument, not the original redis instance.
12+
- Removed `Redis.current`. You shouldn't assume there is a single global Redis connection, use a connection pool instead,
13+
and libaries using Redis should accept a Redis instance (or connection pool) as a config. E.g. `MyLibrary.redis = Redis.new(...)`.
14+
- Removed the `synchrony` driver.
15+
- Removed `Redis.exists_returns_integer`, it's now always enabled.
16+
317
# 4.7.1
418

519
* Gracefully handle OpenSSL 3.0 EOF Errors (`OpenSSL::SSL::SSLError: SSL_read: unexpected eof while reading`). See #1106

Gemfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@ gemspec
66

77
gem 'minitest'
88
gem 'rake'
9-
gem 'rubocop', '~> 1.0', '< 1.12'
9+
gem 'rubocop', '~> 1.25.1'
10+
gem 'mocha'
11+
12+
gem 'redis-client', github: 'redis-rb/redis-client'
13+
gem 'hiredis-client'
14+
gem 'redis-cluster-client', github: 'redis-rb/redis-cluster-client' if ENV['REDIS_CLUSTER']

README.md

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ If you want to [authenticate](https://redis.io/topics/sentinel#configuring-senti
111111
SENTINELS = [{ host: '127.0.0.1', port: 26380, password: 'mysecret' },
112112
{ host: '127.0.0.1', port: 26381, password: 'mysecret' }]
113113

114-
redis = Redis.new(host: 'mymaster', sentinels: SENTINELS, role: :master)
114+
redis = Redis.new(name: 'mymaster', sentinels: SENTINELS, role: :master)
115115
```
116116

117117
## Cluster support
@@ -434,30 +434,6 @@ When instantiating the client object, specify hiredis:
434434
redis = Redis.new(:driver => :hiredis)
435435
```
436436

437-
### synchrony
438-
439-
The synchrony driver adds support for [em-synchrony][em-synchrony].
440-
This makes redis-rb work with EventMachine's asynchronous I/O, while not
441-
changing the exposed API. The hiredis gem needs to be available as
442-
well, because the synchrony driver uses hiredis for parsing the Redis
443-
protocol.
444-
445-
[em-synchrony]: https://github.com/igrigorik/em-synchrony
446-
447-
In your Gemfile, include em-synchrony and hiredis:
448-
449-
```ruby
450-
gem "redis", "~> 3.0.1"
451-
gem "hiredis", "~> 0.4.5"
452-
gem "em-synchrony"
453-
```
454-
455-
When instantiating the client object, specify synchrony:
456-
457-
```ruby
458-
redis = Redis.new(:driver => :synchrony)
459-
```
460-
461437
## Testing
462438

463439
This library is tested against recent Ruby and Redis versions.

benchmarking/cluster_slot.rb

Lines changed: 0 additions & 36 deletions
This file was deleted.

benchmarking/logging.rb

Lines changed: 0 additions & 74 deletions
This file was deleted.

bin/cluster_creator

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#!/usr/bin/env ruby
2-
32
# frozen_string_literal: true
43

4+
puts ARGV.join(" ")
5+
require 'bundler/setup'
6+
57
$LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
68
require_relative '../test/support/cluster/orchestrator'
79

810
urls = ARGV.map { |host_port| "redis://#{host_port}" }
9-
orchestrator = ClusterOrchestrator.new(urls, timeout: 30.0)
11+
orchestrator = ClusterOrchestrator.new(urls, timeout: 3.0)
1012
orchestrator.rebuild
1113
orchestrator.close

examples/sentinel/start

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ pids = []
1313

1414
at_exit do
1515
pids.each do |pid|
16-
begin
17-
Process.kill(:INT, pid)
18-
rescue Errno::ESRCH
19-
end
16+
Process.kill(:INT, pid)
17+
rescue Errno::ESRCH
2018
end
2119

2220
Process.waitall

examples/unicorn/config.ru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
run lambda { |_env|
4-
[200, { "Content-Type" => "text/plain" }, [Redis.current.randomkey]]
4+
[200, { "Content-Type" => "text/plain" }, [MyApp.redis.randomkey]]
55
}

0 commit comments

Comments
 (0)