pools 1.1.0 → 2.0.0

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: ae62a54973d24d74b569f5f8b9f3a5affa38bb302dc866618d1f662f0520705f
4
- data.tar.gz: 6f086c672eaf44b059be9ef3ecb94edbd78b8612f8d98bd745242e626ff3bdd7
3
+ metadata.gz: 460de6de46759d3160426610e1a5fdc6a50b4476e6775dc721949638be980718
4
+ data.tar.gz: 28bc2c93bebea91f91b43f3a53a8d9a3ca005ad3b574b118a129dcf8d1142a9a
5
5
  SHA512:
6
- metadata.gz: 276d6e6c33998dfe312010116f17a84296e84192e53b63a673334d1c23a175f0bf1a4b4e3233be3bb53ff1677ca7ede3d8032e83b883e8f2c0efd6e9adb655cd
7
- data.tar.gz: d1357f7383545bff1233298d371d9a55e7670587a837910d02e0dab8d8348ec8ee3da95f6687e9fff88be394247add308521be0a8eb8b057c788b58235108901
6
+ metadata.gz: d1dc435f9830a1bfe54755ed7fca3bebf67b4f334ce5af922db164b44904f5886333edbc379e23938b70768762fc866c86cae281ee014c86be17caf40ebb6a96
7
+ data.tar.gz: 1431f11e93f2e3cf279a6644c7d62c4e9278fbc82de002676b208c59b981829887f7574ee20e58e4a7cb1950cb4e62c8f060bce65f4ebf7a6a370983675b424e
data/lib/pools/handler.rb CHANGED
@@ -12,7 +12,9 @@ module Pools
12
12
 
13
13
  # Add a new connection pool to the mix
14
14
  def add(pool, name = nil)
15
- @pools[name || pool.object_id] = pool
15
+ key = name || pool.object_id
16
+ raise(%Q(Pool "#{name}" already exists)) if @pools[name]
17
+ @pools[name] = pool
16
18
  end
17
19
 
18
20
  # Returns any connections in use by the current thread back to the
data/lib/pools/pooled.rb CHANGED
@@ -32,9 +32,15 @@ module Pools
32
32
  module ClassMethods
33
33
  def connection_methods(*methods)
34
34
  methods.each do |method|
35
- define_method(method) do |*params, &block|
35
+ define_method(method) do |*args, **kwargs, &block|
36
36
  with_connection do |client|
37
- client.send(method, *params, &block)
37
+ # https://bugs.ruby-lang.org/issues/14415
38
+ # Needed for pre-2.5 Ruby support
39
+ if !kwargs.empty?
40
+ client.send(method, *args, **kwargs, &block)
41
+ else
42
+ client.send(method, *args, &block)
43
+ end
38
44
  end
39
45
  end
40
46
  end
@@ -49,4 +55,4 @@ module Pools
49
55
  end
50
56
  end
51
57
  end
52
- end
58
+ end
data/lib/redis/pooled.rb CHANGED
@@ -11,7 +11,11 @@ class Redis
11
11
  end
12
12
 
13
13
  def __connection
14
- Redis.connect(@redis_options)
14
+ if Redis.respond_to?(:connect) # 3.x and earlier
15
+ Redis.connect(@redis_options)
16
+ else
17
+ Redis.new(@redis_options)
18
+ end
15
19
  end
16
20
 
17
21
  def __disconnect(client)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Rykov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-07 00:00:00.000000000 Z
11
+ date: 2022-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.0.0
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '5.3'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +24,6 @@ dependencies:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 3.0.0
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '5.3'
33
27
  description: 'Generalized connection pooling
34
28
 
35
29
  '