distribute_reads 0.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/lib/distribute_reads/job_methods.rb +1 -5
- data/lib/distribute_reads/version.rb +1 -1
- data/lib/distribute_reads.rb +3 -12
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b3c66d675a295bdde2d0dcc05590ed3af790a8a44718b2044fb6482c3330836
|
4
|
+
data.tar.gz: 63db83095a8dcadfec723451c89afc9e3f712cef35a01d610b87f308febaa37c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ce34129b83a7e5e5511dd96e5590d6bf80333124290591e94fc2db6291b45979f5dfd4467d2f81c1be4040cab55e451db9c41e318a1aa3285b94802e52c0244
|
7
|
+
data.tar.gz: 725b782d62ad8521407a1fd0b3c4a634e09147c83cb40f150cc04bc0ca64f1ac18565e9cfdb24966cf1296b1e4cd30388a8568ec83d84e5fccb1c1d2ce7e7ee7
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 0.4.0 (2022-12-28)
|
2
|
+
|
3
|
+
- Made `distribute_reads` method private to behave like `Kernel` methods
|
4
|
+
- Dropped support for Makara 0.3
|
5
|
+
- Dropped support for Ruby < 2.6 and Active Record < 5.2
|
6
|
+
|
1
7
|
## 0.3.5 (2022-01-30)
|
2
8
|
|
3
9
|
- Added support for Aurora Postgres 13 replication lag
|
data/README.md
CHANGED
@@ -16,7 +16,7 @@ gem "distribute_reads"
|
|
16
16
|
|
17
17
|
## How to Use
|
18
18
|
|
19
|
-
[Makara](https://github.com/
|
19
|
+
[Makara](https://github.com/instacart/makara) does most of the work. First, update `database.yml` to use it:
|
20
20
|
|
21
21
|
```yml
|
22
22
|
default: &default
|
@@ -7,11 +7,7 @@ module DistributeReads
|
|
7
7
|
included do
|
8
8
|
before_perform do
|
9
9
|
if DistributeReads.by_default
|
10
|
-
|
11
|
-
Makara::Context.set_current(Makara::Context.generate)
|
12
|
-
else
|
13
|
-
Makara::Context.release_all
|
14
|
-
end
|
10
|
+
Makara::Context.release_all
|
15
11
|
end
|
16
12
|
end
|
17
13
|
end
|
data/lib/distribute_reads.rb
CHANGED
@@ -126,7 +126,6 @@ module DistributeReads
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
-
# private
|
130
129
|
def self.backtrace_cleaner
|
131
130
|
@backtrace_cleaner ||= begin
|
132
131
|
bc = ActiveSupport::BacktraceCleaner.new
|
@@ -136,8 +135,8 @@ module DistributeReads
|
|
136
135
|
bc
|
137
136
|
end
|
138
137
|
end
|
138
|
+
private_class_method :backtrace_cleaner
|
139
139
|
|
140
|
-
# private
|
141
140
|
def self.with_replica
|
142
141
|
previous_value = Thread.current[:distribute_reads]
|
143
142
|
begin
|
@@ -147,14 +146,7 @@ module DistributeReads
|
|
147
146
|
Thread.current[:distribute_reads] = previous_value
|
148
147
|
end
|
149
148
|
end
|
150
|
-
|
151
|
-
# private
|
152
|
-
def self.makara3?
|
153
|
-
unless defined?(@makara3)
|
154
|
-
@makara3 = Gem::Version.new(Makara::VERSION.to_s) < Gem::Version.new("0.4.0")
|
155
|
-
end
|
156
|
-
@makara3
|
157
|
-
end
|
149
|
+
private_class_method :with_replica
|
158
150
|
|
159
151
|
# legacy
|
160
152
|
def self.default_to_primary
|
@@ -169,8 +161,7 @@ end
|
|
169
161
|
|
170
162
|
Makara::Proxy.prepend DistributeReads::AppropriatePool
|
171
163
|
Object.include DistributeReads::GlobalMethods
|
172
|
-
|
173
|
-
# Object.send :private, :distribute_reads
|
164
|
+
Object.send :private, :distribute_reads
|
174
165
|
|
175
166
|
ActiveSupport.on_load(:active_job) do
|
176
167
|
require "distribute_reads/job_methods"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: distribute_reads
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: makara
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.4'
|
27
27
|
description:
|
28
28
|
email: andrew@ankane.org
|
29
29
|
executables: []
|
@@ -51,14 +51,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '2.
|
54
|
+
version: '2.6'
|
55
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '0'
|
60
60
|
requirements: []
|
61
|
-
rubygems_version: 3.
|
61
|
+
rubygems_version: 3.4.1
|
62
62
|
signing_key:
|
63
63
|
specification_version: 4
|
64
64
|
summary: Scale database reads with replicas in Rails
|