I fixed the multithreading issue with connection management a while back, remove mutex, it only slows down job processing

This commit is contained in:
Sam 2013-05-20 10:31:17 +10:00
parent 80fb20816c
commit b9c4bf9870
1 changed files with 3 additions and 9 deletions

View File

@ -22,10 +22,6 @@ module Jobs
self.new.perform(opts)
end
def self.mutex
@mutex ||= Mutex.new
end
def execute(opts={})
raise "Overwrite me!"
end
@ -57,11 +53,9 @@ module Jobs
dbs.each do |db|
begin
Jobs::Base.mutex.synchronize do
RailsMultisite::ConnectionManagement.establish_connection(db: db)
I18n.locale = SiteSetting.default_locale
execute(opts)
end
RailsMultisite::ConnectionManagement.establish_connection(db: db)
I18n.locale = SiteSetting.default_locale
execute(opts)
ensure
ActiveRecord::Base.connection_handler.clear_active_connections!
end