mirror of
https://github.com/plashchynski/crono.git
synced 2026-03-28 12:22:04 +01:00
Add CLI#run_job
This commit is contained in:
@@ -7,8 +7,10 @@ module Crono
|
||||
def run
|
||||
load_rails
|
||||
print_banner
|
||||
# start_working_loop
|
||||
end
|
||||
|
||||
private
|
||||
def print_banner
|
||||
puts "Loading Crono #{Crono::VERSION}"
|
||||
puts "Running in #{RUBY_DESCRIPTION}"
|
||||
@@ -19,5 +21,15 @@ module Crono
|
||||
require File.expand_path("config/environment.rb")
|
||||
::Rails.application.eager_load!
|
||||
end
|
||||
|
||||
def run_job(klass)
|
||||
Thread.new { klass.new.perform }
|
||||
end
|
||||
|
||||
def start_working_loop
|
||||
Config.instance.schedule.each do |klass, period|
|
||||
run_job(klass)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user