mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:04:11 +08:00
Fix the build.
This commit is contained in:
parent
36f8697a59
commit
9dcb11f553
|
@ -126,7 +126,7 @@ module Jobs
|
|||
begin
|
||||
exception = {}
|
||||
|
||||
RailsMultisite::ConnectionManagement.with_connection(db: db) do
|
||||
RailsMultisite::ConnectionManagement.with_connection(db) do
|
||||
begin
|
||||
I18n.locale = SiteSetting.default_locale || "en"
|
||||
I18n.ensure_all_loaded!
|
||||
|
|
|
@ -65,7 +65,7 @@ module Scheduler
|
|||
db, job, desc = @queue.deq(non_block)
|
||||
db ||= RailsMultisite::ConnectionManagement::DEFAULT
|
||||
|
||||
RailsMultisite::ConnectionManagement.with_connection(db: db) do
|
||||
RailsMultisite::ConnectionManagement.with_connection(db) do
|
||||
begin
|
||||
job.call
|
||||
rescue => ex
|
||||
|
|
|
@ -77,7 +77,7 @@ module Scheduler
|
|||
@mutex.synchronize { info.write! }
|
||||
|
||||
if @manager.enable_stats
|
||||
RailsMultisite::ConnectionManagement.with_connection(db: "default") do
|
||||
RailsMultisite::ConnectionManagement.with_connection("default") do
|
||||
stat = SchedulerStat.create!(
|
||||
name: klass.to_s,
|
||||
hostname: hostname,
|
||||
|
@ -102,7 +102,7 @@ module Scheduler
|
|||
info.prev_result = failed ? "FAILED" : "OK"
|
||||
info.current_owner = nil
|
||||
if stat
|
||||
RailsMultisite::ConnectionManagement.with_connection(db: "default") do
|
||||
RailsMultisite::ConnectionManagement.with_connection("default") do
|
||||
stat.update!(
|
||||
duration_ms: duration,
|
||||
live_slots_finish: GC.stat[:heap_live_slots],
|
||||
|
|
|
@ -1,6 +1,24 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "Running Sidekiq Jobs in Multisite" do
|
||||
let(:conn) { RailsMultisite::ConnectionManagement }
|
||||
|
||||
before do
|
||||
conn.config_filename = "spec/fixtures/multisite/two_dbs.yml"
|
||||
conn.load_settings!
|
||||
conn.remove_class_variable(:@@current_db)
|
||||
end
|
||||
|
||||
after do
|
||||
conn.clear_settings!
|
||||
|
||||
[:@@db_spec_cache, :@@host_spec_cache, :@@default_spec].each do |class_variable|
|
||||
conn.remove_class_variable(class_variable)
|
||||
end
|
||||
|
||||
conn.set_current_db
|
||||
end
|
||||
|
||||
it 'should revert back to the default connection' do
|
||||
expect(RailsMultisite::ConnectionManagement.current_db)
|
||||
.to eq('default')
|
||||
|
|
Loading…
Reference in New Issue
Block a user