redis 6.1.0 → 6.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60795c590a9da34c630e8c79cac2d14c4ef086830e99fe0e1dc5064086043211
4
- data.tar.gz: d0afae36b8c35d2dbdd9f9e532bf5efd7bad50d51ac1430a76426b31de15f537
3
+ metadata.gz: f14e8b50136ac0f9d3f4ed9ee42d67d89331e252e6fcd6fdc1a2e9872e8f490c
4
+ data.tar.gz: bb54985a3444a468591bb4f9f0609b665ac142fc3903fd9cbc9ddee3503e5491
5
5
  SHA512:
6
- metadata.gz: cc27fa6d693e8f40f352b0a366469035e577609740d6585e2921876e51392e2f58e85ead7a369a690bd152e40ca0f1fcb613b901c04b1ed91ee2f331981d1bbb
7
- data.tar.gz: d6d1729aa8e92c42d89b1fedf0d81821a01507772c53719fbd52df34fe1b925011cca39c8c9872762ad6ddb43d5154103e9547174db9dc12ce315fb1dc0b32a2
6
+ metadata.gz: 9f028b241c8c5f06c027caa107ca89978f605e1c491ae7fdfae4ffc85ce3c55847cce30ad2a0ad432d2422ac6b6769d735f3d7db7070263e9e4ccb66bc55ec04
7
+ data.tar.gz: 7a31417aebcba9bffff6fbf184e04c9066586816484b868ddea26069ca3fd7e3d3f283181e92cd19a6f5f84c36ba8a4a5e905cd6ddf9e630a7e71f8a89e34159
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # 6.1.1
2
+
3
+ ## Bug fixes
4
+
5
+ - Fix `subscribe`, `psubscribe` and `ssubscribe` (and their `_with_timeout` forms) dropping a
6
+ message or raising `RedisClient::ProtocolError` when the message arrives in parts more than
7
+ 50 ms apart, a regression in 6.1.0. Not fixed on the `hiredis-client` driver, which can still
8
+ crash on such a message. (#1417)
9
+
1
10
  # 6.1.0
2
11
 
3
12
  ## New features
@@ -117,33 +117,54 @@ class Redis
117
117
  # timed form keeps the caller's overall deadline, nil meaning "no event
118
118
  # within the requested timeout".
119
119
  def next_event(timeout)
120
- if timeout > 0
121
- deadline = Process.clock_gettime(Process::CLOCK_MONOTONIC) + timeout
122
- loop do
123
- writer_priority_wait
120
+ deadline = Process.clock_gettime(Process::CLOCK_MONOTONIC) + timeout if timeout > 0
121
+ loop do
122
+ writer_priority_wait
123
+ remaining = 0 # blocking
124
+ if deadline
124
125
  remaining = deadline - Process.clock_gettime(Process::CLOCK_MONOTONIC)
125
126
  return nil if remaining <= 0
126
-
127
- event = guarded_read([remaining, READ_SLICE].min)
128
- return event if event
129
- end
130
- else
131
- loop do
132
- writer_priority_wait
133
- event = guarded_read(READ_SLICE)
134
- return event if event
135
127
  end
128
+
129
+ event = guarded_read(remaining)
130
+ return event if event
136
131
  end
137
132
  end
138
133
 
139
- def guarded_read(slice)
134
+ # A driver read that times out partway through a message cannot be resumed,
135
+ # so only the wait for data is sliced; once bytes are there the message is
136
+ # read whole, with the caller's timeout (0 blocks).
137
+ def guarded_read(timeout)
138
+ slice = timeout > 0 ? [timeout, READ_SLICE].min : READ_SLICE
140
139
  @write_monitor.synchronize do
141
140
  raise SubscriptionError, "This client is closed" if @closed
142
141
 
143
- @client.next_event(slice)
142
+ case data_ready?(slice)
143
+ when true then @client.next_event(timeout)
144
+ # hiredis: the read itself is sliced, so a message arriving in parts
145
+ # more than a slice apart still breaks there.
146
+ when nil then @client.next_event(slice)
147
+ end
144
148
  end
145
149
  end
146
150
 
151
+ # true/false once the wait is over; nil when the driver gives no way to
152
+ # tell (hiredis exposes no socket), or the socket is gone and the read
153
+ # itself should raise the mapped error.
154
+ def data_ready?(slice)
155
+ io = @client.instance_variable_get(:@raw_connection)&.instance_variable_get(:@io)
156
+ return unless io.is_a?(::RedisClient::RubyConnection::BufferedIO)
157
+ return true if io.instance_variable_get(:@offset) < io.instance_variable_get(:@buffer).bytesize
158
+
159
+ socket = io.instance_variable_get(:@io)
160
+ # OpenSSL may hold decrypted bytes the raw socket no longer reports.
161
+ return true if socket.respond_to?(:pending) && socket.pending > 0
162
+
163
+ !socket.to_io.wait_readable(slice).nil?
164
+ rescue IOError
165
+ nil
166
+ end
167
+
147
168
  # Bounded writer priority: a queued writer gets the monitor before the next
148
169
  # read slice. sleep deterministically deschedules this thread (Thread.pass
149
170
  # is a hint MRI 3.2 ignores in favor of the barging re-acquirer); the bound
data/lib/redis/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Redis
4
- VERSION = '6.1.0'
4
+ VERSION = '6.1.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ezra Zygmuntowicz
@@ -15,7 +15,7 @@ authors:
15
15
  - Pieter Noordhuis
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2026-11-23 00:00:00.000000000 Z
18
+ date: 2026-11-26 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: redis-client
@@ -97,9 +97,9 @@ licenses:
97
97
  metadata:
98
98
  bug_tracker_uri: https://github.com/redis/redis-rb/issues
99
99
  changelog_uri: https://github.com/redis/redis-rb/blob/master/CHANGELOG.md
100
- documentation_uri: https://www.rubydoc.info/gems/redis/6.1.0
100
+ documentation_uri: https://www.rubydoc.info/gems/redis/6.1.1
101
101
  homepage_uri: https://github.com/redis/redis-rb
102
- source_code_uri: https://github.com/redis/redis-rb/tree/v6.1.0
102
+ source_code_uri: https://github.com/redis/redis-rb/tree/v6.1.1
103
103
  rdoc_options: []
104
104
  require_paths:
105
105
  - lib