redis 5.0.2 → 5.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15a91a0ef8a3f697bc35cb5c4029d979134b58984b7c23deee36707cfc081a32
4
- data.tar.gz: 9cdb4881111253801c3f1ad5a4f5fafa38b14b384ba595bbc422fa899d006619
3
+ metadata.gz: cba7e365db1b9e04cf596a09210949a7ad7be48df25863d28654690e0f9c9ded
4
+ data.tar.gz: c846522122894b000cbae0fedbee70bd1b27880baa8138e6aea73f6a06820146
5
5
  SHA512:
6
- metadata.gz: 69731342edc1c5d5b26ce18deecac7c3b4d1a2b452272df977ae3ccb5cd5812174ebdbb1a78b19e96d6ccf8e45a0256e46a927ad1a2a7a9577c08eb35055e800
7
- data.tar.gz: f9994ab4b694c99862ba932795c842c5fa24d72790ee44e908162e144608c481f2052aa2af6cca42d173b77af3e8a5a9d90dffcaf828f3a818dc1196fe4aa590
6
+ metadata.gz: d7e818dba56ff62bb7b95c221acffd9637be088b0da1b76870cfc6c7b8980e3da32636a1e99ff4debcc85aaf8c8d70d105301beae4fb0ee0255bef502b72caf0
7
+ data.tar.gz: 28956e7dab6c737e923c3d19a03ce41d81b7e7406d04119a3a225748f1150d708d0b0baf231ce08e297626d58c9ab8cc97a5f31be93750a1e0d5362778a085fe
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Unreleased
2
2
 
3
+ # 5.0.3
4
+
5
+ - Add `OutOfMemoryError` as a subclass of `CommandError`
6
+
3
7
  # 5.0.2
4
8
 
5
9
  - Fix `Redis#close` to properly reset the fork protection check.
data/lib/redis/client.rb CHANGED
@@ -15,7 +15,8 @@ class Redis
15
15
  RedisClient::WrongTypeError => Redis::WrongTypeError,
16
16
  RedisClient::ReadOnlyError => Redis::ReadOnlyError,
17
17
  RedisClient::ProtocolError => Redis::ProtocolError,
18
- }.freeze
18
+ RedisClient::OutOfMemoryError => Redis::OutOfMemoryError,
19
+ }
19
20
 
20
21
  class << self
21
22
  def config(**kwargs)
@@ -78,7 +79,7 @@ class Redis
78
79
  def call_v(command, &block)
79
80
  super(command, &block)
80
81
  rescue ::RedisClient::Error => error
81
- raise ERROR_MAPPING.fetch(error.class), error.message, error.backtrace
82
+ translate_error!(error)
82
83
  end
83
84
 
84
85
  def blocking_call_v(timeout, command, &block)
@@ -91,19 +92,19 @@ class Redis
91
92
 
92
93
  super(timeout, command, &block)
93
94
  rescue ::RedisClient::Error => error
94
- raise ERROR_MAPPING.fetch(error.class), error.message, error.backtrace
95
+ translate_error!(error)
95
96
  end
96
97
 
97
98
  def pipelined
98
99
  super
99
100
  rescue ::RedisClient::Error => error
100
- raise ERROR_MAPPING.fetch(error.class), error.message, error.backtrace
101
+ translate_error!(error)
101
102
  end
102
103
 
103
104
  def multi
104
105
  super
105
106
  rescue ::RedisClient::Error => error
106
- raise ERROR_MAPPING.fetch(error.class), error.message, error.backtrace
107
+ translate_error!(error)
107
108
  end
108
109
 
109
110
  def disable_reconnection(&block)
@@ -121,6 +122,21 @@ class Redis
121
122
 
122
123
  private
123
124
 
125
+ def translate_error!(error)
126
+ redis_error = translate_error_class(error.class)
127
+ raise redis_error, error.message, error.backtrace
128
+ end
129
+
130
+ def translate_error_class(error_class)
131
+ ERROR_MAPPING.fetch(error_class)
132
+ rescue IndexError
133
+ if (client_error = error_class.ancestors.find { |a| ERROR_MAPPING[a] })
134
+ ERROR_MAPPING[error_class] = ERROR_MAPPING[client_error]
135
+ else
136
+ raise
137
+ end
138
+ end
139
+
124
140
  def ensure_connected(retryable: true)
125
141
  unless @inherit_socket || (@pid ||= Process.pid) == Process.pid
126
142
  raise InheritedError,
data/lib/redis/errors.rb CHANGED
@@ -29,6 +29,9 @@ class Redis
29
29
  class ReadOnlyError < CommandError
30
30
  end
31
31
 
32
+ class OutOfMemoryError < CommandError
33
+ end
34
+
32
35
  # Base error for connection related errors.
33
36
  class BaseConnectionError < BaseError
34
37
  end
data/lib/redis/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Redis
4
- VERSION = '5.0.2'
4
+ VERSION = '5.0.3'
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: 5.0.2
4
+ version: 5.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ezra Zygmuntowicz
@@ -16,22 +16,22 @@ authors:
16
16
  autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
- date: 2022-08-31 00:00:00.000000000 Z
19
+ date: 2022-09-06 00:00:00.000000000 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: redis-client
23
23
  requirement: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '0.7'
27
+ version: 0.7.4
28
28
  type: :runtime
29
29
  prerelease: false
30
30
  version_requirements: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '0.7'
34
+ version: 0.7.4
35
35
  description: |2
36
36
  A Ruby client that tries to match Redis' API one-to-one, while still
37
37
  providing an idiomatic interface.
@@ -75,9 +75,9 @@ licenses:
75
75
  metadata:
76
76
  bug_tracker_uri: https://github.com/redis/redis-rb/issues
77
77
  changelog_uri: https://github.com/redis/redis-rb/blob/master/CHANGELOG.md
78
- documentation_uri: https://www.rubydoc.info/gems/redis/5.0.2
78
+ documentation_uri: https://www.rubydoc.info/gems/redis/5.0.3
79
79
  homepage_uri: https://github.com/redis/redis-rb
80
- source_code_uri: https://github.com/redis/redis-rb/tree/v5.0.2
80
+ source_code_uri: https://github.com/redis/redis-rb/tree/v5.0.3
81
81
  post_install_message:
82
82
  rdoc_options: []
83
83
  require_paths: