From 86a83d25ddd5887fd36dba234f739a5a68dd7383 Mon Sep 17 00:00:00 2001 From: Thiago Pradi Date: Fri, 1 Nov 2013 00:17:26 -0200 Subject: [PATCH] Removing verify_connection config - This was a old hack and isn't necessary anymore. --- README.mkdn | 8 -------- lib/octopus/proxy.rb | 7 ------- spec/config/shards.yml | 1 - spec/octopus/proxy_spec.rb | 5 ----- 4 files changed, 21 deletions(-) diff --git a/README.mkdn b/README.mkdn index 774b729e..7916bc0f 100644 --- a/README.mkdn +++ b/README.mkdn @@ -122,14 +122,6 @@ If you want to send a specified action, or all actions from a controller, to a s To see the complete list of features and syntax, please check out our Wiki Want to see sample rails applications using octopus features? please check it out: Sharding Example and Replication Example. Also, we have an example that shows how to use Octopus without Rails: Octopus + Sinatra Example. - -## Important! -Occasionally, an application might lose a connection to a database; when this happens, ActiveRecord will raise an exception. Add the following line to your application configuration if you are experiencing this issue: - - verify_connection: true - -This will tell Octopus to verify the connection before sending the query. - ## Mixing Octopus with the Rails multiple database model If you want to set a custom connection to a specific model, use the syntax `octopus_establish_connection` syntax: diff --git a/lib/octopus/proxy.rb b/lib/octopus/proxy.rb index 15c2ec58..cc17106e 100644 --- a/lib/octopus/proxy.rb +++ b/lib/octopus/proxy.rb @@ -15,12 +15,6 @@ def initialize_shards(config) @shards[:master] = ActiveRecord::Base.connection_pool_without_octopus() @config = ActiveRecord::Base.connection_pool_without_octopus.connection.instance_variable_get(:@config) - if !config.nil? && config.has_key?("verify_connection") - @verify_connection = config["verify_connection"] - else - @verify_connection = false - end - if !config.nil? @entire_sharded = config['entire_sharded'] shards_config = config[Octopus.rails_env()] @@ -150,7 +144,6 @@ def safe_connection(connection_pool) end def select_connection - @shards[shard_name].verify_active_connections! if @verify_connection safe_connection(@shards[shard_name]) end diff --git a/spec/config/shards.yml b/spec/config/shards.yml index a2b9bea2..d69503a3 100644 --- a/spec/config/shards.yml +++ b/spec/config/shards.yml @@ -102,7 +102,6 @@ production_fully_replicated: octopus_rails: replicated: true - verify_connection: true environments: - staging - production diff --git a/spec/octopus/proxy_spec.rb b/spec/octopus/proxy_spec.rb index 858b935e..80620f4e 100644 --- a/spec/octopus/proxy_spec.rb +++ b/spec/octopus/proxy_spec.rb @@ -26,10 +26,6 @@ proxy.instance_variable_get(:@replicated).should be_false end - it "should not verify connections for default" do - proxy.instance_variable_get(:@verify_connection).should be_false - end - it "should work with thiking sphinx" do config = proxy.instance_variable_get(:@config) config[:adapter].should == "mysql2" @@ -140,7 +136,6 @@ Octopus.config() proxy.instance_variable_get(:@replicated).should be_true - proxy.instance_variable_get(:@verify_connection).should be_true Octopus.environments.should == ["staging", "production"] end