replica_pools 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/replica_pools/query_cache.rb +3 -1
- data/lib/replica_pools/version.rb +1 -1
- data/spec/query_cache_spec.rb +13 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9a32096014e9f2cd137adb7c8fe226173f40d9dea893a319c0dab24cbdf8371
|
4
|
+
data.tar.gz: da62952df8213322963f8b8ce0c5da9ed8efe381c2348801794ec0ef0b6d294a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f2d2abc5f7badb102c8116213b306d35336f6d54c651a74d6fcaa0e37c53c5282c46fbc643984ffde43f5e54d868051c38590372b8af4329741da1247b68128
|
7
|
+
data.tar.gz: 51c4514ec6e0fa79ea2e6b128fd4d6d3866916d65d89ec743f49621678a5997c0dd3bc0bfe78a25acd72c39d61c5f13523a9f84a9160259966f9408f9c56b109
|
data/README.md
CHANGED
@@ -24,6 +24,8 @@ module ReplicaPools
|
|
24
24
|
# there may be more args for Rails 5.0+, but we only care about arel, name, and binds for caching.
|
25
25
|
relation, name, raw_binds = args
|
26
26
|
|
27
|
+
# Rails 6.2 breaks this method as locked? is no longer available
|
28
|
+
# https://github.com/kickstarter/replica_pools/issues/26
|
27
29
|
if !query_cache_enabled || locked?(relation)
|
28
30
|
return route_to(current, :select_all, *args)
|
29
31
|
end
|
@@ -32,7 +34,7 @@ module ReplicaPools
|
|
32
34
|
if raw_binds.blank? && relation.is_a?(ActiveRecord::Relation)
|
33
35
|
arel, binds = relation.arel, relation.bind_values
|
34
36
|
else
|
35
|
-
arel, binds = relation, raw_binds
|
37
|
+
arel, binds = relation, Array(raw_binds)
|
36
38
|
end
|
37
39
|
|
38
40
|
sql = to_sql(arel, binds)
|
data/spec/query_cache_spec.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rack'
|
2
2
|
require_relative 'spec_helper'
|
3
|
+
require_relative 'config/test_model'
|
3
4
|
|
4
5
|
describe ReplicaPools::QueryCache do
|
5
6
|
before(:each) do
|
@@ -103,4 +104,16 @@ describe ReplicaPools::QueryCache do
|
|
103
104
|
end
|
104
105
|
end
|
105
106
|
end
|
107
|
+
|
108
|
+
describe '.pluck regression test' do
|
109
|
+
it 'should work with query caching' do
|
110
|
+
TestModel.connection.enable_query_cache!
|
111
|
+
expect(TestModel.pluck(:id).count).to eql TestModel.all.count
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'should work if query cache is not enabled' do
|
115
|
+
TestModel.connection.disable_query_cache!
|
116
|
+
expect(TestModel.pluck(:id).count).to eql TestModel.all.count
|
117
|
+
end
|
118
|
+
end
|
106
119
|
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.2.
|
4
|
+
version: 2.2.1
|
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:
|
12
|
+
date: 2021-04-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -95,6 +95,20 @@ dependencies:
|
|
95
95
|
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: pry
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
98
112
|
description: Connection proxy for ActiveRecord for leader / replica setups.
|
99
113
|
email: dan@kickstarter.com
|
100
114
|
executables: []
|
@@ -138,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
152
|
- !ruby/object:Gem::Version
|
139
153
|
version: '1.2'
|
140
154
|
requirements: []
|
141
|
-
rubygems_version: 3.
|
155
|
+
rubygems_version: 3.0.3
|
142
156
|
signing_key:
|
143
157
|
specification_version: 4
|
144
158
|
summary: Connection proxy for ActiveRecord for leader / replica setups.
|