mirror of
https://github.com/plashchynski/crono.git
synced 2026-04-20 07:51:31 +02:00
Clean up
This commit is contained in:
@@ -62,7 +62,7 @@ module Crono
|
||||
logger.info 'Jobs:'
|
||||
Crono.scheduler.jobs.each do |job|
|
||||
logger.info "'#{job.performer}' with rule '#{job.period.description}'"\
|
||||
"next time will perform at #{job.next}"
|
||||
" next time will perform at #{job.next}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -80,7 +80,7 @@ module Crono
|
||||
end
|
||||
|
||||
def start_working_loop
|
||||
while true
|
||||
loop do
|
||||
next_time, jobs = Crono.scheduler.next_jobs
|
||||
sleep(next_time - Time.now)
|
||||
jobs.each(&:perform)
|
||||
|
||||
@@ -60,9 +60,7 @@ module Crono
|
||||
end
|
||||
|
||||
def perform_job
|
||||
performer_instance = performer.new
|
||||
performer_instance.instance_variable_set(:@_crono_job, self)
|
||||
performer_instance.perform
|
||||
performer.new.perform
|
||||
finished_time_sec = format('%.2f', Time.now - last_performed_at)
|
||||
rescue StandardError => e
|
||||
handle_job_fail(e, finished_time_sec)
|
||||
|
||||
Reference in New Issue
Block a user