mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 11:20:57 -06:00
I fixed the multithreading issue with connection management a while back, remove mutex, it only slows down job processing
This commit is contained in:
parent
80fb20816c
commit
b9c4bf9870
12
lib/jobs.rb
12
lib/jobs.rb
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user