module RubyClock
Constants
- VERSION
Public Instance Methods
listen_to_signals()
click to toggle source
# File lib/ruby-clock.rb, line 10 def listen_to_signals signals = %w[INT TERM] signals.each do |signal| old_handler = Signal.trap(signal) do shutdown if old_handler.respond_to?(:call) old_handler.call else exit end end end end
run_jobs()
click to toggle source
# File lib/ruby-clock.rb, line 28 def run_jobs puts "Starting ruby-clock with #{schedule.jobs.size} jobs" Rufus::Scheduler.singleton.join end
schedule()
click to toggle source
# File lib/ruby-clock.rb, line 24 def schedule Rufus::Scheduler.singleton end
shutdown()
click to toggle source
# File lib/ruby-clock.rb, line 5 def shutdown puts "Shutting down ruby-clock 🐈️ 👋" Rufus::Scheduler.singleton.shutdown(wait: ENV['RUBY_CLOCK_SHUTDOWN_WAIT_SECONDS']&.to_i || 29) end