replica_pools 2.4.2 → 2.6.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: bbd92d614f51ed7b7d9ed39d174fff5b7574b6dfe1f9fc09370e823237b6278b
4
- data.tar.gz: 03f068ac02942552e6aa847e95012f1e38f4dc56ba63f580459c7446290edf4f
3
+ metadata.gz: ca5913b321778c59730e29d5845c52cec3acc626ce4940e921fb40309ef3f39b
4
+ data.tar.gz: 89cbec0176c695013e1fa3691d02d004aa05bda88ccfcaf60c1452da06d7b9ac
5
5
  SHA512:
6
- metadata.gz: 5aee205f1a54bfd92eaaa27dd6696f6d3ee337f58a95ee3f273a88167250c8fa9f5e4372ea18e2c261011c01d502f614aa6bc8d6b0225b3b77b58e1d960e5b7a
7
- data.tar.gz: 81833fdc2aeb92f02ad89e907d8c36498e2816310ab8935590c312e052909cb244df315ad2038eaa809d625e379c9edf6c8e4ed3218f398f5b752f095282f9be
6
+ metadata.gz: 6a99fc420ef83d2eee33302c0c50095a64c8c7f47c11471bc3310afb3557e22e64f6a6b4a288cd750b830c552cb9f6a3cc742e07c95ae9b1816a25f20d31b0c2
7
+ data.tar.gz: eb1e3a46c3e4bb83b5510f782f493e7490a8165bd5ea23952726d6d3e36bef7216811960254e87292a0628534ec06471aa442c56535b3a68cfaab2c9b471499a
@@ -20,7 +20,7 @@ module ReplicaPools
20
20
  # Make sure transactions run on leader
21
21
  # Even if they're initiated from ActiveRecord::Base
22
22
  # (which doesn't have our hijack).
23
- def transaction(options = {}, &block)
23
+ def transaction(**options, &block)
24
24
  if self.connection.kind_of?(ConnectionProxy)
25
25
  super
26
26
  else
@@ -64,8 +64,8 @@ module ReplicaPools
64
64
  end
65
65
  end
66
66
 
67
- def transaction(*args, &block)
68
- with_leader { leader.transaction(*args, &block) }
67
+ def transaction(...)
68
+ with_leader { leader.transaction(...) }
69
69
  end
70
70
 
71
71
  def next_replica!
@@ -86,9 +86,9 @@ module ReplicaPools
86
86
  # Proxies any unknown methods to leader.
87
87
  # Safe methods have been generated during `setup!`.
88
88
  # Creates a method to speed up subsequent calls.
89
- def method_missing(method, *args, &block)
90
- self.class.define_method(method) do |*args, &block|
91
- route_to(leader, method, *args, &block).tap do
89
+ def method_missing(method, *args, **kwargs, &block)
90
+ self.class.define_method(method) do |*args, **kwargs, &block|
91
+ route_to(leader, method, *args, **kwargs, &block).tap do
92
92
  if %i[insert delete update].include?(method)
93
93
  leader.retrieve_connection.clear_query_cache
94
94
  end
@@ -101,9 +101,9 @@ module ReplicaPools
101
101
  leader_depth > 0
102
102
  end
103
103
 
104
- def route_to(conn, method, *args, &block)
104
+ def route_to(conn, method, *args, **keyword_args, &block)
105
105
  raise ReplicaPools::LeaderDisabled.new if ReplicaPools.config.disable_leader && conn == leader
106
- conn.retrieve_connection.send(method, *args, &block)
106
+ conn.retrieve_connection.send(method, *args, **keyword_args, &block)
107
107
  rescue => e
108
108
  ReplicaPools.log :error, "Error during ##{method}: #{e}"
109
109
  log_proxy_state
@@ -18,11 +18,11 @@ module ReplicaPools
18
18
  # select_all is trickier. it needs to use the leader
19
19
  # connection for cache logic, but ultimately pass its query
20
20
  # through to whatever connection is current.
21
- def select_all(*args)
21
+ def select_all(*args, **kwargs)
22
22
  relation, name, raw_binds = args
23
23
 
24
24
  if !query_cache_enabled || locked?(relation)
25
- return route_to(current, :select_all, *args)
25
+ return route_to(current, :select_all, *args, **kwargs)
26
26
  end
27
27
 
28
28
  # duplicate binds_from_relation behavior introduced in 4.2.
@@ -38,9 +38,9 @@ module ReplicaPools
38
38
  args[2] = binds
39
39
 
40
40
  if Gem::Version.new(ActiveRecord.version) < Gem::Version.new('5.1')
41
- cache_sql(sql, binds) { route_to(current, :select_all, *args) }
41
+ cache_sql(sql, binds) { route_to(current, :select_all, *args, **kwargs) }
42
42
  else
43
- cache_sql(sql, name, binds) { route_to(current, :select_all, *args) }
43
+ cache_sql(sql, name, binds) { route_to(current, :select_all, *args, **kwargs) }
44
44
  end
45
45
  end
46
46
 
@@ -1,3 +1,3 @@
1
1
  module ReplicaPools
2
- VERSION = "2.4.2"
2
+ VERSION = "2.6.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: replica_pools
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Drabik
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-02-09 00:00:00.000000000 Z
12
+ date: 2023-03-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -151,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
152
  - - ">="
153
153
  - !ruby/object:Gem::Version
154
- version: '0'
154
+ version: 2.7.0
155
155
  required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - ">="