switchman 3.0.20 → 3.0.21

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: 1e131a4d625dcfe3ff7854591e717574e3fddf49e29cb9a5aa2e1cc9df8c2f10
4
- data.tar.gz: 385c067530063b6d4bcdc3f7f0463a57a54082c14be4e00ddf1f520ea5fabb26
3
+ metadata.gz: df4352d56024adc191b904c1786c43dff9a685be0c7e82e5813339a107ac6df3
4
+ data.tar.gz: 7f6ce97fdadcf3dff63b64065e94b2c4de5a481b234ec6f36429ff7eb796eccc
5
5
  SHA512:
6
- metadata.gz: e6c9d4e232befbbf02b1da406d9bae6fd67731b0942ea3c46d29b87b40f2e457e0f0a03edc14547dd3269d619d0f019beab415150229e8d4a2f395cb3a4e51ea
7
- data.tar.gz: f6e536576fa2b1f33c2f641ba0dbf0fdb3e487706558efb2bb924af63b8bc939ed45ee491676d5887313d428e64d42cfc13604fc291e561127cd829ced728471
6
+ metadata.gz: 26b862b5b2d44c3aebf24d2ce469e332ff3af117b75e05559d1343b399a01d36db1a321f6fb2f48e535d3e0f99517c56c0dd549911d47b9ef024e8652b5f54b3
7
+ data.tar.gz: 229c8277f8df802f2f5f29221d66afbaba873ff70b0f97ca0ff9356a99b58d8b1dc08bd6fb07c75800275dfc4ef63ec8296451bdfed1204860fbfc1cd764d291
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'switchman/database_server'
4
+
3
5
  module Switchman
4
6
  module ActiveRecord
5
7
  module Base
@@ -65,12 +67,9 @@ module Switchman
65
67
  end
66
68
 
67
69
  def connected_to_stack
68
- ret = super
69
- # Really early in boot, DatabaseServer may not be loaded yet,
70
- # which is fine since we will guard when we initialize sharding in that case
71
- return ret unless const_defined?(:DatabaseServer)
72
- return ret if Thread.current.thread_variable?(:ar_connected_to_stack)
70
+ return super if Thread.current.thread_variable?(:ar_connected_to_stack)
73
71
 
72
+ ret = super
74
73
  DatabaseServer.guard_servers
75
74
  ret
76
75
  end
@@ -50,7 +50,7 @@ module Switchman
50
50
  end
51
51
 
52
52
  def guard_servers
53
- all.each { |db| db.guard! if db.config[:prefer_secondary] } if Shard.sharding_initialized
53
+ all.each { |db| db.guard! if db.config[:prefer_secondary] }
54
54
  end
55
55
 
56
56
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Switchman
4
- VERSION = '3.0.20'
4
+ VERSION = '3.0.21'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: switchman
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.20
4
+ version: 3.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer