mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
Start up the Job scheduler after all the other initializers have loaded.
We do this so that plugins can register scheduled jobs.
This commit is contained in:
parent
e1b96d2f15
commit
caa2564b83
1 changed files with 15 additions and 14 deletions
|
@ -23,21 +23,22 @@ if Sidekiq.server?
|
|||
end
|
||||
end
|
||||
|
||||
require 'scheduler/scheduler'
|
||||
|
||||
manager = Scheduler::Manager.new
|
||||
Scheduler::Manager.discover_schedules.each do |schedule|
|
||||
manager.ensure_schedule!(schedule)
|
||||
end
|
||||
Thread.new do
|
||||
while true
|
||||
begin
|
||||
manager.tick
|
||||
rescue => e
|
||||
# the show must go on
|
||||
Discourse.handle_exception(e)
|
||||
Rails.application.config.after_initialize do
|
||||
require 'scheduler/scheduler'
|
||||
manager = Scheduler::Manager.new
|
||||
Scheduler::Manager.discover_schedules.each do |schedule|
|
||||
manager.ensure_schedule!(schedule)
|
||||
end
|
||||
Thread.new do
|
||||
while true
|
||||
begin
|
||||
manager.tick
|
||||
rescue => e
|
||||
# the show must go on
|
||||
Discourse.handle_exception(e)
|
||||
end
|
||||
sleep 1
|
||||
end
|
||||
sleep 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue