BUGFIX: allow sorting prior to sidekiq starting

This commit is contained in:
Sam 2014-02-10 09:21:46 +11:00
parent f4e3ec905c
commit de9e1a5049
1 changed files with 9 additions and 1 deletions

View File

@ -8,7 +8,15 @@ module Scheduler
RailsMultisite::ConnectionManagement.with_connection("default") do
@manager = Scheduler::Manager.without_runner
@schedules = Scheduler::Manager.discover_schedules.sort do |a,b|
a.schedule_info.next_run <=> b.schedule_info.next_run
a_next = a.schedule_info.next_run
b_next = b.schedule_info.next_run
if a_next && b_next
a_next <=> b_next
elsif a_next
-1
else
1
end
end
erb File.read(File.join(VIEWS, 'scheduler.erb')), locals: {view_path: VIEWS}
end