Permalink
Browse files

Ensure all sharded connections are checked in at the end of each Rails

request, by hooking into clear_active_connections!
  • Loading branch information...
1 parent 60bf115 commit 2fd4ad8a714b21e289fd5dc8524fabeabb176232 @mperham committed Jan 17, 2009
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/data_fabric/ar22.rb
@@ -1,3 +1,12 @@
+
+class ActiveRecord::ConnectionAdapters::ConnectionHandler
+ def clear_active_connections_with_data_fabric!
+ clear_active_connections_without_data_fabric!
+ DataFabric::ConnectionProxy.shard_pools.each_value { |pool| pool.release_connection }
+ end
+ alias_method_chain :clear_active_connections!, :data_fabric
+end
+
module DataFabric
module Extensions
def self.included(model)

0 comments on commit 2fd4ad8

Please sign in to comment.