slave_pools 1.0.0.rc2 → 1.0.0.rc3

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
  SHA1:
3
- metadata.gz: ada15436188b84a0fae0247b38aeac4ec0344649
4
- data.tar.gz: 480836da042e92a4c86fc213a9b1033c3e628af7
3
+ metadata.gz: 9e6a45beb574601032f4618737cb16626fad3b32
4
+ data.tar.gz: edf4ff14ab00c4eb85551b9a977c52c362bdef43
5
5
  SHA512:
6
- metadata.gz: 16ec508961e20c2785b7c9851ffde2856c72f07220abc6a0364c175cac98ead0cbb6c972de9b1d87635636d8626774fab8e190fdaa8f762873955fdd2a251933
7
- data.tar.gz: 855daf885ddb869034f642f15677e388475b1a220b1846d3a5ec6fa49570dc2ff22fe7d555043986288bfd183a1b044f989bdc8bb0870958affe13b400a9fbdc
6
+ metadata.gz: 2daa6e7d816fd82fb85d8f34644be0e9588ec6e34653e6887b3a866f9affb47091f82503963fc067b74e77c84c2085e5c23acc7ee0a641677015b6c8c5fbaa3b
7
+ data.tar.gz: 6c3770d21e1d19b4b8bec198730bace7f95a109af22644fda294b552db13d0bbd98e5da38f37d703d8492a65e71bec445cc4161165aeee5078ea3e39eb6f75de
@@ -131,13 +131,10 @@ module SlavePools
131
131
  private
132
132
 
133
133
  def log_proxy_state
134
- SlavePools.log :error, "Master Value: #{master}"
134
+ SlavePools.log :error, "Current Connection: #{current}"
135
+ SlavePools.log :error, "Current Pool Name: #{current_pool.name}"
136
+ SlavePools.log :error, "Current Pool Members: #{current_pool.slaves}"
135
137
  SlavePools.log :error, "Master Depth: #{master_depth}"
136
- SlavePools.log :error, "Current Value: #{current}"
137
- SlavePools.log :error, "Current Pool: #{current_pool}"
138
- SlavePools.log :error, "Current Pool Slaves: #{current_pool.slaves}" if current_pool
139
- SlavePools.log :error, "Current Pool Name: #{current_pool.name}" if current_pool
140
- SlavePools.log :error, "Default Pool: #{default_pool}"
141
138
  end
142
139
  end
143
140
  end
@@ -15,6 +15,11 @@ module SlavePools
15
15
  )
16
16
  end
17
17
 
18
+ if pools.empty?
19
+ SlavePools.log :info, "No pools found for #{SlavePools.config.environment}. Loading a default pool with master instead."
20
+ pools[:default] = SlavePools::Pool.new('default', [ActiveRecord::Base])
21
+ end
22
+
18
23
  super pools
19
24
  end
20
25
 
@@ -24,7 +29,6 @@ module SlavePools
24
29
  def pool_configurations
25
30
  ActiveRecord::Base.configurations.map do |name, config|
26
31
  next unless name.to_s =~ /#{SlavePools.config.environment}_pool_(.*)_name_(.*)/
27
- next unless connection_valid?(config)
28
32
  [name, $1, $2]
29
33
  end.compact
30
34
  end
@@ -44,17 +48,5 @@ module SlavePools
44
48
  }, __FILE__, __LINE__
45
49
  SlavePools.const_get(class_name)
46
50
  end
47
-
48
- # tests a connection to be sure it's configured
49
- def connection_valid?(db_config)
50
- ActiveRecord::Base.establish_connection(db_config)
51
- return ActiveRecord::Base.connection && ActiveRecord::Base.connected?
52
- rescue => e
53
- SlavePools.log :error, "Could not connect to #{db_config.inspect}"
54
- SlavePools.log :error, e.to_s
55
- return false
56
- ensure
57
- ActiveRecord::Base.establish_connection(SlavePools.config.environment)
58
- end
59
51
  end
60
52
  end
@@ -1,3 +1,3 @@
1
1
  module SlavePools
2
- VERSION = "1.0.0.rc2"
2
+ VERSION = "1.0.0.rc3"
3
3
  end
data/lib/slave_pools.rb CHANGED
@@ -20,11 +20,6 @@ module SlavePools
20
20
  end
21
21
 
22
22
  def setup!
23
- if pools.empty?
24
- log :info, "No pools found for #{config.environment}. Loading a default pool with master instead."
25
- pools['default'] = SlavePools::Pool.new('default', [ActiveRecord::Base])
26
- end
27
-
28
23
  ConnectionProxy.generate_safe_delegations
29
24
 
30
25
  ActiveRecord::Base.send(:extend, SlavePools::Hijack)
@@ -29,10 +29,6 @@ describe SlavePools do
29
29
  defined?(SlavePools::SecondaryDb3).should_not be_nil
30
30
  end
31
31
 
32
- it "should not generate classes for an invalid DB in the database.yml" do
33
- defined?(SlavePools::DefaultFakeDb).should be_nil
34
- end
35
-
36
32
  context "with_master" do
37
33
  it 'should revert to previous slave connection' do
38
34
  @proxy.current = @proxy.current_slave
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slave_pools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc2
4
+ version: 1.0.0.rc3
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: 2013-12-31 00:00:00.000000000 Z
12
+ date: 2014-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord