redis-client 0.22.1 → 0.22.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac943e2497c5e52f402307d0acb4ba73cb25f6946efe66cb398a40a6b378b7e1
4
- data.tar.gz: '034386c130f23d555834fa788a1ae8409d90dbf35bd0312045e35c715c26899d'
3
+ metadata.gz: 796fe04bd550f92d5bf2656a62de54caf1f640b45ab5d5f51fed61d0b61ee883
4
+ data.tar.gz: 4b34ce4e0ed5a2d4816863970789e7c23ce53fe8a561718b78b79432d09e3fe8
5
5
  SHA512:
6
- metadata.gz: b83ef90c1f9f5994c7fbcf3fb304f41d977fbb04cdb0c02e08bc6294b064e939fad19b225fb7ac7b5fd95103712c46d690cdeaa724a2e07e6d343d35a483a14c
7
- data.tar.gz: 0e3f65ac5ecceedc577d87dbf25604b331be6cfc4ac92c6f54633dc1acbc6ae4519ce32df3a4033a2594c5451194abbf0b80d9a6bcdb996169401af1805bb230
6
+ metadata.gz: d9dfb29603171606e71daaa43474812790988876720dd254a0069fc429ba035ede74b1b19d243967b9adb61c0d48ab4aa2931ef188cd2bb17d820b480967c897
7
+ data.tar.gz: e6ff3a4543991e139a26f8fa4bdb714aafe83678490f9890ca5fd0ec1a95bdddd0c8fec57dcb4ff88fb28a19d577a556172cb39e4bd4f290d41c6871de43345b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Unreleased
2
2
 
3
+ # 0.22.2
4
+
5
+ - Fix the sentinel client to properly extend timeout for blocking commands.
6
+ - Fix IPv6 support in `RedisClient::Config#server_url`.
7
+
3
8
  # 0.22.1
4
9
 
5
10
  - Fix `ProtocolError: Unknown sigil type` errors when using SSL connection. See #190.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- redis-client (0.22.1)
4
+ redis-client (0.22.2)
5
5
  connection_pool
6
6
 
7
7
  GEM
@@ -15,7 +15,7 @@ GEM
15
15
  hiredis (0.6.3-java)
16
16
  json (2.7.1)
17
17
  json (2.7.1-java)
18
- minitest (5.22.3)
18
+ minitest (5.23.0)
19
19
  parallel (1.24.0)
20
20
  parser (3.3.0.5)
21
21
  ast (~> 2.4.1)
data/README.md CHANGED
@@ -149,7 +149,7 @@ SENTINELS = [{ host: '127.0.0.1', port: 26380 },
149
149
  redis_config = RedisClient.sentinel(name: 'mymaster', sentinels: SENTINELS, role: :master, password: 'mysecret')
150
150
  ```
151
151
 
152
- So you have to provide Sentinel credential and Redis explictly even they are the same
152
+ So you have to provide Sentinel credential and Redis explicitly even they are the same
153
153
 
154
154
  ```ruby
155
155
  # Use 'mysecret' to authenticate against the mymaster instance and sentinel
@@ -524,7 +524,7 @@ recover for a while.
524
524
 
525
525
  [Circuit breakers are a pattern that does exactly that](https://en.wikipedia.org/wiki/Circuit_breaker_design_pattern).
526
526
 
527
- Configuation options:
527
+ Configuration options:
528
528
 
529
529
  - `error_threshold`. The amount of errors to encounter within `error_threshold_timeout` amount of time before opening the circuit, that is to start rejecting requests instantly.
530
530
  - `error_threshold_timeout`. The amount of time in seconds that `error_threshold` errors must occur to open the circuit. Defaults to `error_timeout` seconds if not set.
@@ -133,7 +133,13 @@ class RedisClient
133
133
  url = "#{url}?db=#{db}"
134
134
  end
135
135
  else
136
- url = "redis#{'s' if ssl?}://#{host}:#{port}"
136
+ # add brackets to IPv6 address
137
+ redis_host = if host.count(":") >= 2
138
+ "[#{host}]"
139
+ else
140
+ host
141
+ end
142
+ url = "redis#{'s' if ssl?}://#{redis_host}:#{port}"
137
143
  if db != 0
138
144
  url = "#{url}/#{db}"
139
145
  end
@@ -28,7 +28,7 @@ class RedisClient
28
28
  def call(command, timeout)
29
29
  @pending_reads += 1
30
30
  write(command)
31
- result = read(timeout)
31
+ result = read(connection_timeout(timeout))
32
32
  @pending_reads -= 1
33
33
  if result.is_a?(Error)
34
34
  result._set_command(command)
@@ -49,7 +49,7 @@ class RedisClient
49
49
 
50
50
  size.times do |index|
51
51
  timeout = timeouts && timeouts[index]
52
- result = read(timeout)
52
+ result = read(connection_timeout(timeout))
53
53
  @pending_reads -= 1
54
54
 
55
55
  # A multi/exec command can return an array of results.
@@ -73,5 +73,14 @@ class RedisClient
73
73
  results
74
74
  end
75
75
  end
76
+
77
+ def connection_timeout(timeout)
78
+ return timeout unless timeout && timeout > 0
79
+
80
+ # Can't use the command timeout argument as the connection timeout
81
+ # otherwise it would be very racy. So we add the regular read_timeout on top
82
+ # to account for the network delay.
83
+ timeout + config.read_timeout
84
+ end
76
85
  end
77
86
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class RedisClient
4
- VERSION = "0.22.1"
4
+ VERSION = "0.22.2"
5
5
  end
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.22.1
4
+ version: 0.22.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-16 00:00:00.000000000 Z
11
+ date: 2024-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  requirements: []
80
- rubygems_version: 3.5.5
80
+ rubygems_version: 3.5.9
81
81
  signing_key:
82
82
  specification_version: 4
83
83
  summary: Simple low-level client for Redis 6+