Small improvements.

This commit is contained in:
Martin Edenhofer 2015-07-01 00:26:02 +02:00
parent d73784e7fd
commit d685c8f264

View file

@ -26,7 +26,7 @@ class Scheduler < ApplicationModel
end end
# read/load jobs and check if it is alredy started # read/load jobs and check if it is alredy started
jobs = Scheduler.where( 'active = ?', true ) jobs = Scheduler.where( 'active = ?', true ).order('prio ASC')
jobs.each {|job| jobs.each {|job|
# ignore job is still running # ignore job is still running
@ -38,13 +38,13 @@ class Scheduler < ApplicationModel
# run job as own thread # run job as own thread
@@jobs_started[ job.id ] = true @@jobs_started[ job.id ] = true
start_job(job) start_job(job)
sleep 10
} }
sleep 60 sleep 60
end end
end end
def self.start_job( job ) def self.start_job( job )
sleep 4
Thread.new { Thread.new {
@ -82,7 +82,6 @@ class Scheduler < ApplicationModel
end end
def self._start_job( job, try_count = 0, try_run_time = Time.zone.now ) def self._start_job( job, try_count = 0, try_run_time = Time.zone.now )
sleep 5
begin begin
job.last_run = Time.zone.now job.last_run = Time.zone.now
job.pid = Thread.current.object_id job.pid = Thread.current.object_id