replica_pools 2.6.7 → 2.7.0

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: 3ea5f09fa92639eed7f9b4ca9cfd8f2d0e0ed4fb7448c0c2a9cbd85405efb890
4
- data.tar.gz: ae4de86f30747a71de0962504a84aaed5c383b8d5b2618143256f666cc829f94
3
+ metadata.gz: e8f7bc1f36d6ea4f994b91f407c8f289d45c12e263b94bc016fcde19efcfea36
4
+ data.tar.gz: 24311cbfaf609e30f3f40f0592160416a529f5dc2dfcf22e3bc2706d6de651e7
5
5
  SHA512:
6
- metadata.gz: 489ba3598de82b85a43d33b9f9b65630be4983926f084f18ee9a3fdcb5fadd963bd6870352dd7fd8bba490fd12503006b21e9578fc6ad33254ef745921efd8ca
7
- data.tar.gz: 9d177b1e2bf10b36b0008820e8d8045853bf975d47a1b767ecb28bb77993991ec9d8b16de7ba653ecd1aede3d482317db9b52537c074372a0fcd0864d2992f86
6
+ metadata.gz: 727999871c66cb238ac2789e5a84232f5d10686bda0b63702e983c49fa41274a14e4962da5337468d3010624dae61728350301c7c21275b1c15f86d83a7e558c
7
+ data.tar.gz: 56e361f3a46aba77f90ac92de4bb09d0216313798b74eda0f6bb59917c96b1aa6bcef456a5eac5f9fa2d5faa466fa0568997dd39a2385b6d74ba0b9408bcb47e
@@ -17,6 +17,10 @@ module ReplicaPools
17
17
  ReplicaPools.proxy
18
18
  end
19
19
 
20
+ def with_connection_proxy
21
+ yield ReplicaPools.proxy
22
+ end
23
+
20
24
  # Make sure transactions run on leader
21
25
  # Even if they're initiated from ActiveRecord::Base
22
26
  # (which doesn't have our hijack).
@@ -42,7 +42,7 @@ module ReplicaPools
42
42
  select_values
43
43
  verify!
44
44
  ]
45
- elsif [5, 6, 7].include?(ActiveRecord::VERSION::MAJOR)
45
+ elsif [5, 6, 7, 8].include?(ActiveRecord::VERSION::MAJOR)
46
46
  %i[
47
47
  active?
48
48
  cacheable_query
@@ -18,6 +18,7 @@ module ReplicaPools
18
18
  def hijack_connection
19
19
  class << self
20
20
  alias_method :connection, :connection_proxy
21
+ alias_method :with_connection, :with_connection_proxy
21
22
  end
22
23
  end
23
24
  end
@@ -1,3 +1,3 @@
1
1
  module ReplicaPools
2
- VERSION = "2.6.7"
2
+ VERSION = "2.7.0"
3
3
  end
@@ -22,7 +22,7 @@ describe ReplicaPools::QueryCache do
22
22
  @default_replica2.should_not_receive(:select_all)
23
23
  @leader.should_not_receive(:select_all)
24
24
  3.times { @proxy.select_all(@sql) }
25
- @leader.query_cache.keys.size.should == 1
25
+ @leader.query_cache.size.should == 1
26
26
  end
27
27
  end
28
28
 
@@ -38,9 +38,9 @@ describe ReplicaPools::QueryCache do
38
38
  5.times do |i|
39
39
  @proxy.select_all(@sql)
40
40
  @proxy.select_all(@sql)
41
- @leader.query_cache.keys.size.should == 1
41
+ @leader.query_cache.size.should == 1
42
42
  @proxy.send(meths[i], '')
43
- @leader.query_cache.keys.size.should == 0
43
+ @leader.query_cache.size.should == 0
44
44
  end
45
45
  end
46
46
  end
data/spec/spec_helper.rb CHANGED
@@ -11,6 +11,8 @@ module Rails
11
11
  end
12
12
 
13
13
  require 'active_record'
14
+ # Rails::Engine (loaded by replica_pools/engine) needs ActionDispatch since Rails 8.0. Real apps already have it loaded.
15
+ require 'action_dispatch'
14
16
  spec_dir = File.dirname(__FILE__)
15
17
  ActiveRecord::Base.logger = Logger.new(spec_dir + "/debug.log")
16
18
  ActiveRecord::Base.configurations = YAML::safe_load(ERB.new(File.read(spec_dir + '/config/database.yml')).result, aliases: true)
@@ -50,4 +52,7 @@ RSpec.configure do |c|
50
52
  c.mock_with :rspec do |c|
51
53
  c.syntax = [:expect, :should]
52
54
  end
55
+
56
+ c.filter_run focus: true
57
+ c.run_all_when_everything_filtered = true
53
58
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: replica_pools
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.7
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Drabik
8
8
  - Lance Ivy
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-05-15 00:00:00.000000000 Z
12
+ date: 2026-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -20,7 +20,7 @@ dependencies:
20
20
  version: '6.0'
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
- version: '8.0'
23
+ version: '8.2'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -30,7 +30,7 @@ dependencies:
30
30
  version: '6.0'
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '8.0'
33
+ version: '8.2'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: mysql2
36
36
  requirement: !ruby/object:Gem::Requirement
@@ -143,7 +143,7 @@ homepage: https://github.com/kickstarter/replica_pools
143
143
  licenses:
144
144
  - MIT
145
145
  metadata: {}
146
- post_install_message:
146
+ post_install_message:
147
147
  rdoc_options: []
148
148
  require_paths:
149
149
  - lib
@@ -158,8 +158,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  - !ruby/object:Gem::Version
159
159
  version: '1.2'
160
160
  requirements: []
161
- rubygems_version: 3.4.19
162
- signing_key:
161
+ rubygems_version: 3.5.22
162
+ signing_key:
163
163
  specification_version: 4
164
164
  summary: Connection proxy for ActiveRecord for leader / replica setups.
165
165
  test_files: