fix bug where non-multisite environment would run out of connections

This commit is contained in:
Sam 2013-05-20 00:22:31 +10:00
parent 5f7f87437c
commit ceddb6e0da
2 changed files with 5 additions and 1 deletions

View File

@ -66,7 +66,11 @@ module Jobs
ActiveRecord::Base.connection_handler.clear_active_connections! ActiveRecord::Base.connection_handler.clear_active_connections!
end end
end end
ensure
ActiveRecord::Base.connection_handler.clear_active_connections!
end end
end end
def self.enqueue(job_name, opts={}) def self.enqueue(job_name, opts={})

View File

@ -4,7 +4,7 @@ module RailsMultisite
def self.establish_connection(opts) def self.establish_connection(opts)
if opts[:db] == "default" && (!defined?(@@default_spec) || !@@default_spec) if opts[:db] == "default" && (!defined?(@@default_spec) || !@@default_spec)
ActiveRecord::Base.establish_connection # don't do anything .. handled implicitly
else else
spec = connection_spec(opts) || @@default_spec spec = connection_spec(opts) || @@default_spec
handler = nil handler = nil