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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4fb973f4af2e8828fc62a2c921605d595ee89bf521ba9f2b65f4c4f695225a76
4
- data.tar.gz: 26ac05c9a814401ed03e56dfd7ceafa637e3ac0dcdb8aba79e12f9d664b5bbac
3
+ metadata.gz: 044c145f24198d69d3f221698f3452ee301e947cefe7f675eb8e7b704effc353
4
+ data.tar.gz: 1f7c381f92ae63fcd8dc0ced50fa317591d319fbb1473af87dab01ac2e77a855
5
5
  SHA512:
6
- metadata.gz: f40892ea166bb86ea89809d7b0e1cb74616ba55251f3208272319dab0d71322eb2c4efca3aaa2c134a9e0ae6adc1c20ea2cae16451d3c2fd6205e4f344cd27a8
7
- data.tar.gz: 415fa474c9e3185f9d39b5410747f3d0a9feaf775e9a7e92d1595bc28d94e8ce69caa06d1c36eb646a98c94f963bc16ae27e54780260172689792066cf06ada2
6
+ metadata.gz: 88019e465c3f305b16eca8bdf05a6b75fb9eec4b5d8b598167cadd904b86e403af9a460d36865286ece8224218f4e93a7249cb81a26a90a8d63c7a6f65fb5f03
7
+ data.tar.gz: 1c336a5dbd584864aae1a422300e1468b456521a170754b6f2c138c6f4a10997401db9ae729eb799c3ffad64255b227e3d02cf54ea60f7e39e1ee759128f29bb
@@ -1,3 +1,7 @@
1
+ ## 0.3.1
2
+
3
+ - Added source location to logging
4
+
1
5
  ## 0.3.0
2
6
 
3
7
  - Use logger instead of stderr
@@ -97,7 +97,24 @@ module DistributeReads
97
97
  end
98
98
 
99
99
  def self.log(message)
100
- logger.info("[distribute_reads] #{message}") if logger
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 => e
26
+ rescue DistributeReads::NoReplicasAvailable
27
27
  # TODO rescue more exceptions?
28
28
  false
29
29
  end
@@ -1,3 +1,3 @@
1
1
  module DistributeReads
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  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.0
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-06-14 00:00:00.000000000 Z
11
+ date: 2019-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: makara