redis-client 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +2 -2
- data/lib/redis_client/connection_mixin.rb +14 -0
- data/lib/redis_client/pooled.rb +17 -37
- data/lib/redis_client/ruby_connection.rb +1 -0
- data/lib/redis_client/version.rb +1 -1
- data/lib/redis_client.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4699c416da87ac3ed64b078ac60643a3baaa7fc2e3884feb58cc86aeb619083
|
4
|
+
data.tar.gz: 5305b72684041089b57c12f493b16e81901718654058e2a5f920b18bb2b83792
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 119c4cf4e1a0eed4f9e67ad2be84fc6a63404cde61519a697efd85b643779cb41b30b32f765ec3308ccaf7fa4903684c9dab1ecb86b1289db2566b1943ac7010
|
7
|
+
data.tar.gz: dbcba8c22c20d4ac33d1e7a495bf95cb30bca7a8b63d98d8944f2c61abfefbf4a40fc3d3222591a85ab8936c5b9e83c946095458b9b31748fe3e3e4e4e37db9e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
+
# 0.8.1
|
4
|
+
|
5
|
+
- Make the client resilient to `Timeout.timeout` or `Thread#kill` use (it still still very much discouraged to use).
|
6
|
+
Use of async interrupts could cause responses to be interleaved.
|
7
|
+
- hiredis: handle commands returning a top-level `false` (no command does this today, but some extensions might).
|
8
|
+
- Workaround a bug in Ruby 2.6 causing a crash if the `debug` gem is enabled when `redis-client` is being required. Fix: #48
|
9
|
+
|
3
10
|
# 0.8.0
|
4
11
|
|
5
12
|
- Add a `connect` interface to the instrumentation API.
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
redis-client (0.8.
|
4
|
+
redis-client (0.8.1)
|
5
5
|
connection_pool
|
6
6
|
|
7
7
|
GEM
|
@@ -10,7 +10,7 @@ GEM
|
|
10
10
|
ast (2.4.2)
|
11
11
|
benchmark-ips (2.10.0)
|
12
12
|
byebug (11.1.3)
|
13
|
-
connection_pool (2.
|
13
|
+
connection_pool (2.3.0)
|
14
14
|
hiredis (0.6.3)
|
15
15
|
hiredis (0.6.3-java)
|
16
16
|
minitest (5.15.0)
|
@@ -2,9 +2,21 @@
|
|
2
2
|
|
3
3
|
class RedisClient
|
4
4
|
module ConnectionMixin
|
5
|
+
def initialize
|
6
|
+
@pending_reads = 0
|
7
|
+
end
|
8
|
+
|
9
|
+
def revalidate
|
10
|
+
if @pending_reads == 0 && connected?
|
11
|
+
self
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
5
15
|
def call(command, timeout)
|
16
|
+
@pending_reads += 1
|
6
17
|
write(command)
|
7
18
|
result = read(timeout)
|
19
|
+
@pending_reads -= 1
|
8
20
|
if result.is_a?(CommandError)
|
9
21
|
result._set_command(command)
|
10
22
|
raise result
|
@@ -18,11 +30,13 @@ class RedisClient
|
|
18
30
|
|
19
31
|
size = commands.size
|
20
32
|
results = Array.new(commands.size)
|
33
|
+
@pending_reads += size
|
21
34
|
write_multi(commands)
|
22
35
|
|
23
36
|
size.times do |index|
|
24
37
|
timeout = timeouts && timeouts[index]
|
25
38
|
result = read(timeout)
|
39
|
+
@pending_reads -= 1
|
26
40
|
if result.is_a?(CommandError)
|
27
41
|
result._set_command(commands[index])
|
28
42
|
exception ||= result
|
data/lib/redis_client/pooled.rb
CHANGED
@@ -51,46 +51,26 @@ class RedisClient
|
|
51
51
|
|
52
52
|
methods = %w(pipelined multi pubsub call call_v call_once call_once_v blocking_call blocking_call_v)
|
53
53
|
iterable_methods = %w(scan sscan hscan zscan)
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
iterable_methods.each do |method|
|
64
|
-
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
65
|
-
def #{method}(...)
|
66
|
-
unless block_given?
|
67
|
-
return to_enum(__callee__, ...)
|
68
|
-
end
|
54
|
+
methods.each do |method|
|
55
|
+
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
56
|
+
def #{method}(*args, &block)
|
57
|
+
with { |r| r.#{method}(*args, &block) }
|
58
|
+
end
|
59
|
+
ruby2_keywords :#{method} if respond_to?(:ruby2_keywords, true)
|
60
|
+
RUBY
|
61
|
+
end
|
69
62
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
methods.each do |method|
|
76
|
-
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
77
|
-
def #{method}(*args, &block)
|
78
|
-
with { |r| r.#{method}(*args, &block) }
|
63
|
+
iterable_methods.each do |method|
|
64
|
+
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
65
|
+
def #{method}(*args, &block)
|
66
|
+
unless block_given?
|
67
|
+
return to_enum(__callee__, *args)
|
79
68
|
end
|
80
|
-
RUBY
|
81
|
-
end
|
82
|
-
|
83
|
-
iterable_methods.each do |method|
|
84
|
-
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
85
|
-
def #{method}(*args, &block)
|
86
|
-
unless block_given?
|
87
|
-
return to_enum(__callee__, *args)
|
88
|
-
end
|
89
69
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
70
|
+
with { |r| r.#{method}(*args, &block) }
|
71
|
+
end
|
72
|
+
ruby2_keywords :#{method} if respond_to?(:ruby2_keywords, true)
|
73
|
+
RUBY
|
94
74
|
end
|
95
75
|
|
96
76
|
private
|
@@ -41,6 +41,7 @@ class RedisClient
|
|
41
41
|
SUPPORTS_RESOLV_TIMEOUT = Socket.method(:tcp).parameters.any? { |p| p.last == :resolv_timeout }
|
42
42
|
|
43
43
|
def initialize(config, connect_timeout:, read_timeout:, write_timeout:)
|
44
|
+
super()
|
44
45
|
socket = if config.path
|
45
46
|
UNIXSocket.new(config.path)
|
46
47
|
else
|
data/lib/redis_client/version.rb
CHANGED
data/lib/redis_client.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|