FIX: keep db and job correctly in multisite logs
This ensures we report job and db correctly, previously we were only reporting this on default
This commit is contained in:
parent
19182c0c8f
commit
e4498d2a8a
|
@ -119,11 +119,6 @@ module Jobs
|
||||||
RailsMultisite::ConnectionManagement.all_dbs
|
RailsMultisite::ConnectionManagement.all_dbs
|
||||||
end
|
end
|
||||||
|
|
||||||
logster_env = {}
|
|
||||||
Logster.add_to_env(logster_env, :current_db, 'default')
|
|
||||||
Logster.add_to_env(logster_env, :job, self.class.to_s)
|
|
||||||
Thread.current[Logster::Logger::LOGSTER_ENV] = logster_env
|
|
||||||
|
|
||||||
exceptions = []
|
exceptions = []
|
||||||
dbs.each do |db|
|
dbs.each do |db|
|
||||||
begin
|
begin
|
||||||
|
@ -134,7 +129,11 @@ module Jobs
|
||||||
I18n.locale = SiteSetting.default_locale || "en"
|
I18n.locale = SiteSetting.default_locale || "en"
|
||||||
I18n.ensure_all_loaded!
|
I18n.ensure_all_loaded!
|
||||||
begin
|
begin
|
||||||
|
logster_env = {}
|
||||||
|
Logster.add_to_env(logster_env, :job, self.class.to_s)
|
||||||
Logster.add_to_env(logster_env, :db, db)
|
Logster.add_to_env(logster_env, :db, db)
|
||||||
|
Thread.current[Logster::Logger::LOGSTER_ENV] = logster_env
|
||||||
|
|
||||||
execute(opts)
|
execute(opts)
|
||||||
rescue => e
|
rescue => e
|
||||||
exception[:ex] = e
|
exception[:ex] = e
|
||||||
|
@ -146,7 +145,6 @@ module Jobs
|
||||||
exception[:other] = { problem_db: db }
|
exception[:other] = { problem_db: db }
|
||||||
ensure
|
ensure
|
||||||
total_db_time += Instrumenter.stats.duration_ms
|
total_db_time += Instrumenter.stats.duration_ms
|
||||||
Thread.current[Logster::Logger::LOGSTER_ENV] = nil
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue