tchandy/octopus — pull request #214 by nickmarden (2013-11-29 22:05:36+00:00)
Title: Make it possible to clear connections correctly

Rack middlewares such as ActiveRecord::ConnectionAdapters::ConnectionManagement rely on the `clear_active_connections!` to return previously checked-out connections back to the "free pool" of their ConnectionPool at the end of the app request cycle. Unfortunately the proxied implementation of `clear_active_connections!` in Octopus::Proxy only dispatches to the connection pool for the current shard, so this does not have the desired effect.

This pull request addresses that issue by "shotgunning" any call to `clear_all_connections!' or `clear_active_connections!` to all of the connection pools associated with all of the shards for the current Octopus::Proxy object.

Also, there is another commit included in here to simplify the previous (similar) work that I did on `clear_query_cache`.