distribute_reads 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/distribute_reads.rb +18 -1
- data/lib/distribute_reads/global_methods.rb +1 -1
- data/lib/distribute_reads/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 044c145f24198d69d3f221698f3452ee301e947cefe7f675eb8e7b704effc353
|
4
|
+
data.tar.gz: 1f7c381f92ae63fcd8dc0ced50fa317591d319fbb1473af87dab01ac2e77a855
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88019e465c3f305b16eca8bdf05a6b75fb9eec4b5d8b598167cadd904b86e403af9a460d36865286ece8224218f4e93a7249cb81a26a90a8d63c7a6f65fb5f03
|
7
|
+
data.tar.gz: 1c336a5dbd584864aae1a422300e1468b456521a170754b6f2c138c6f4a10997401db9ae729eb799c3ffad64255b227e3d02cf54ea60f7e39e1ee759128f29bb
|
data/CHANGELOG.md
CHANGED
data/lib/distribute_reads.rb
CHANGED
@@ -97,7 +97,24 @@ module DistributeReads
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def self.log(message)
|
100
|
-
|
100
|
+
if logger
|
101
|
+
logger.info("[distribute_reads] #{message}")
|
102
|
+
|
103
|
+
# show location like Active Record
|
104
|
+
source = backtrace_cleaner.clean(caller.lazy).first
|
105
|
+
logger.info(" ↳ #{source}") if source
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# private
|
110
|
+
def self.backtrace_cleaner
|
111
|
+
@backtrace_cleaner ||= begin
|
112
|
+
bc = ActiveSupport::BacktraceCleaner.new
|
113
|
+
bc.add_silencer { |line| line.include?("lib/distribute_reads") }
|
114
|
+
bc.add_silencer { |line| line.include?("lib/makara") }
|
115
|
+
bc.add_silencer { |line| line.include?("lib/active_record") }
|
116
|
+
bc
|
117
|
+
end
|
101
118
|
end
|
102
119
|
|
103
120
|
# private
|
@@ -23,7 +23,7 @@ module DistributeReads
|
|
23
23
|
current_lag =
|
24
24
|
begin
|
25
25
|
DistributeReads.replication_lag(connection: base_model.connection)
|
26
|
-
rescue DistributeReads::NoReplicasAvailable
|
26
|
+
rescue DistributeReads::NoReplicasAvailable
|
27
27
|
# TODO rescue more exceptions?
|
28
28
|
false
|
29
29
|
end
|
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.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: makara
|