correct multisite issues with scheduler
This commit is contained in:
parent
61f32ed431
commit
9b4fd0b26b
|
@ -25,7 +25,7 @@ if Sidekiq.server?
|
|||
|
||||
if !scheduler_hostname || scheduler_hostname.split(',').include?(`hostname`.strip)
|
||||
require 'scheduler/scheduler'
|
||||
manager = Scheduler::Manager.new
|
||||
manager = Scheduler::Manager.new($redis.without_namespace)
|
||||
Scheduler::Manager.discover_schedules.each do |schedule|
|
||||
manager.ensure_schedule!(schedule)
|
||||
end
|
||||
|
|
|
@ -106,12 +106,17 @@ module Scheduler
|
|||
info.prev_result = failed ? "FAILED" : "OK"
|
||||
info.current_owner = nil
|
||||
if stat
|
||||
begin
|
||||
RailsMultisite::ConnectionManagement.establish_connection(db: "default")
|
||||
stat.update!(
|
||||
duration_ms: duration,
|
||||
live_slots_finish: GC.stat[:heap_live_slots],
|
||||
success: !failed,
|
||||
error: error
|
||||
)
|
||||
ensure
|
||||
ActiveRecord::Base.connection_handler.clear_active_connections!
|
||||
end
|
||||
end
|
||||
attempts(3) do
|
||||
@mutex.synchronize { info.write! }
|
||||
|
|
|
@ -12,7 +12,7 @@ module Scheduler
|
|||
|
||||
data = nil
|
||||
|
||||
if data = $redis.get(key)
|
||||
if data = @manager.redis.get(key)
|
||||
data = JSON.parse(data)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue