Skip to content

Commit

Permalink
Removing verify_connection config
Browse files Browse the repository at this point in the history
- This was a old hack and isn't necessary anymore.
  • Loading branch information
thiagopradi committed Nov 1, 2013
1 parent 1d04302 commit 86a83d2
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 21 deletions.
8 changes: 0 additions & 8 deletions README.mkdn
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="http://wiki.github.com/tchandy/octopus/"> Wiki</a>
Want to see sample rails applications using octopus features? please check it out: <a href="http://github.com/tchandy/octopus_sharding_example">Sharding Example</a> and <a href="http://github.com/tchandy/octopus_replication_example">Replication Example</a>. Also, we have an example that shows how to use Octopus without Rails: <a href="http://github.com/tchandy/octopus_sinatra"> Octopus + Sinatra Example</a>.


## 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:

Expand Down
7 changes: 0 additions & 7 deletions lib/octopus/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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()]
Expand Down Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion spec/config/shards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ production_fully_replicated:

octopus_rails:
replicated: true
verify_connection: true
environments:
- staging
- production
Expand Down
5 changes: 0 additions & 5 deletions spec/octopus/proxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 86a83d2

Please sign in to comment.