From ceddb6e0da92e874b3bee9543915726f1d27d60b Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 20 May 2013 00:22:31 +1000 Subject: [PATCH] fix bug where non-multisite environment would run out of connections --- lib/jobs.rb | 4 ++++ .../lib/rails_multisite/connection_management.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/jobs.rb b/lib/jobs.rb index 31032c4a187..ab1fe063135 100644 --- a/lib/jobs.rb +++ b/lib/jobs.rb @@ -66,7 +66,11 @@ module Jobs ActiveRecord::Base.connection_handler.clear_active_connections! end end + + ensure + ActiveRecord::Base.connection_handler.clear_active_connections! end + end def self.enqueue(job_name, opts={}) diff --git a/vendor/gems/rails_multisite/lib/rails_multisite/connection_management.rb b/vendor/gems/rails_multisite/lib/rails_multisite/connection_management.rb index 32536b16a45..980f543fded 100644 --- a/vendor/gems/rails_multisite/lib/rails_multisite/connection_management.rb +++ b/vendor/gems/rails_multisite/lib/rails_multisite/connection_management.rb @@ -4,7 +4,7 @@ module RailsMultisite def self.establish_connection(opts) if opts[:db] == "default" && (!defined?(@@default_spec) || !@@default_spec) - ActiveRecord::Base.establish_connection + # don't do anything .. handled implicitly else spec = connection_spec(opts) || @@default_spec handler = nil