redis-client 0.7.1 → 0.7.4

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: a4170ea87f36925fbfdd698282bfaacc9d922c5cdb2a3474944cbf1ad10f86a4
4
- data.tar.gz: 46add9543d181621ebb5c54594318d4111c00c8153083b3c84c9363693eceb95
3
+ metadata.gz: e6fbe9260e43212ff9c501d95cf262f0c34e4db3cbc4dc6bebef3e8d2f98fc52
4
+ data.tar.gz: d8356c2d342ae51f70e33b28f5e5679bea021ed31240b35c055ea5ad5625e9a4
5
5
  SHA512:
6
- metadata.gz: ae48b57736db4a41686f2e9462b85c193ebe75bf323d2684c89ae5905aa4000cd69c806fd1ee9d63a117ad6e35a6d4befd28779938726e2ab4932273e32dbe46
7
- data.tar.gz: d17c48e6252575b6842bff27dee3a608f066a9646684d675a2bd9bfd8285c308797c8359137b213f6d736377324e6d10b5f4e3fd306e605d891b14cef93f906f
6
+ metadata.gz: 7ad5fdf44a060e90f3d9a4b350733d208a745e625fa95764c7288047bfa4138e9e882a6608634374c66b3fa595037d8603eb902f431603c8c94048bacfbf8184
7
+ data.tar.gz: c09bea07473c08a6d67b0615811484e50199da37ceb25a977129f616595fc7692d24aa46851272129b4a41c735f83a22dae0922a09bc74f6be72fe28dda2576d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Unreleased
2
2
 
3
+ # 0.7.4
4
+
5
+ - Properly parse script errors on pre 7.0 redis server.
6
+
7
+ # 0.7.3
8
+
9
+ - Fix a bug in `url` parsing conflicting with the `path` option.
10
+
11
+ # 0.7.2
12
+
13
+ - Raise a distinct `RedisClient::OutOfMemoryError`, for Redis `OOM` errors.
14
+ - Fix the instrumentation API to be called even for authentication commands.
15
+ - Fix `url:` configuration to accept a trailing slash.
16
+
3
17
  # 0.7.1
4
18
 
5
19
  - Fix `#pubsub` being called when reconnection is disabled (redis-rb compatibility fix).
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- redis-client (0.7.1)
4
+ redis-client (0.7.4)
5
5
  connection_pool
6
6
 
7
7
  GEM
@@ -14,33 +14,33 @@ GEM
14
14
  hiredis (0.6.3)
15
15
  hiredis (0.6.3-java)
16
16
  minitest (5.15.0)
17
- parallel (1.21.0)
18
- parser (3.1.1.0)
17
+ parallel (1.22.1)
18
+ parser (3.1.2.1)
19
19
  ast (~> 2.4.1)
20
20
  rainbow (3.1.1)
21
21
  rake (13.0.6)
22
- rake-compiler (1.1.9)
22
+ rake-compiler (1.2.0)
23
23
  rake
24
24
  redis (4.6.0)
25
- regexp_parser (2.2.1)
25
+ regexp_parser (2.5.0)
26
26
  rexml (3.2.5)
27
- rubocop (1.25.1)
27
+ rubocop (1.28.2)
28
28
  parallel (~> 1.10)
29
29
  parser (>= 3.1.0.0)
30
30
  rainbow (>= 2.2.2, < 4.0)
31
31
  regexp_parser (>= 1.8, < 3.0)
32
32
  rexml
33
- rubocop-ast (>= 1.15.1, < 2.0)
33
+ rubocop-ast (>= 1.17.0, < 2.0)
34
34
  ruby-progressbar (~> 1.7)
35
35
  unicode-display_width (>= 1.4.0, < 3.0)
36
- rubocop-ast (1.16.0)
36
+ rubocop-ast (1.17.0)
37
37
  parser (>= 3.1.1.0)
38
- rubocop-minitest (0.14.0)
38
+ rubocop-minitest (0.19.1)
39
39
  rubocop (>= 0.90, < 2.0)
40
40
  ruby-progressbar (1.11.0)
41
- stackprof (0.2.19)
42
- toxiproxy (2.0.0)
43
- unicode-display_width (2.1.0)
41
+ stackprof (0.2.21)
42
+ toxiproxy (2.0.2)
43
+ unicode-display_width (2.2.0)
44
44
 
45
45
  PLATFORMS
46
46
  ruby
@@ -149,7 +149,8 @@ class RedisClient
149
149
  URI.decode_www_form_component(uri.password)
150
150
  end
151
151
 
152
- kwargs[:db] ||= Integer(uri.path.delete_prefix("/")) if uri.path && !uri.path.empty?
152
+ db_path = uri.path&.delete_prefix("/")
153
+ kwargs[:db] ||= Integer(db_path) if db_path && !db_path.empty?
153
154
  end
154
155
 
155
156
  super(**kwargs)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class RedisClient
4
- VERSION = "0.7.1"
4
+ VERSION = "0.7.4"
5
5
  end
data/lib/redis_client.rb CHANGED
@@ -94,7 +94,14 @@ class RedisClient
94
94
 
95
95
  class << self
96
96
  def parse(error_message)
97
- code = error_message.split(' ', 2).first
97
+ code = if error_message.start_with?("ERR Error running script")
98
+ # On older redis servers script errors are nested.
99
+ # So we need to parse some more.
100
+ if (match = error_message.match(/:\s-([A-Z]+) /))
101
+ match[1]
102
+ end
103
+ end
104
+ code ||= error_message.split(' ', 2).first
98
105
  klass = ERRORS.fetch(code, self)
99
106
  klass.new(error_message)
100
107
  end
@@ -109,12 +116,14 @@ class RedisClient
109
116
  PermissionError = Class.new(CommandError)
110
117
  ReadOnlyError = Class.new(CommandError)
111
118
  WrongTypeError = Class.new(CommandError)
119
+ OutOfMemoryError = Class.new(CommandError)
112
120
 
113
121
  CommandError::ERRORS = {
114
122
  "WRONGPASS" => AuthenticationError,
115
123
  "NOPERM" => PermissionError,
116
124
  "READONLY" => ReadOnlyError,
117
125
  "WRONGTYPE" => WrongTypeError,
126
+ "OOM" => OutOfMemoryError,
118
127
  }.freeze
119
128
 
120
129
  class << self
@@ -652,11 +661,15 @@ class RedisClient
652
661
  # The connection prelude is deliberately not sent to Middlewares
653
662
  if config.sentinel?
654
663
  prelude << ["ROLE"]
655
- role, = connection.call_pipelined(prelude, nil).last
664
+ role, = Middlewares.call_pipelined(prelude, config) do
665
+ connection.call_pipelined(prelude, nil).last
666
+ end
656
667
  config.check_role!(role)
657
668
  else
658
669
  unless prelude.empty?
659
- connection.call_pipelined(prelude, nil)
670
+ Middlewares.call_pipelined(prelude, config) do
671
+ connection.call_pipelined(prelude, nil)
672
+ end
660
673
  end
661
674
  end
662
675
 
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.7.1
4
+ version: 0.7.4
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-08-19 00:00:00.000000000 Z
11
+ date: 2022-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool