Sha256: bc9d615131ee2069a2415a406707df35b6c3f22afae1fab1025bec110c3939b2
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
module Kuroko2 module Workflow module Scheduler def initialize @hostname = Socket.gethostname @stop = ServerEngine::BlockingFlag.new @processing = ServerEngine::BlockingFlag.new end def run Kuroko2.logger = logger Kuroko2.logger.info "[#{@hostname}-#{worker_id}] Start Workflow::Scheduler" until @stop.wait(2.0) unless @processing.set? begin @processing.set! JobSchedule.transaction do now = Time.now last_scheduled_time = Tick.fetch_then_update(now) JobSchedule.launch_scheduled_jobs!(last_scheduled_time, now) end @processing.reset! end end end rescue Exception => e Kuroko2.logger.fatal("[#{@hostname}-#{worker_id}] #{e.class}: #{e.message}\n" + e.backtrace.map { |trace| " #{trace}" }.join("\n")) raise e end def stop Kuroko2.logger.info "[#{@hostname}-#{worker_id}] Stop Workflow::Scheduler" @stop.set! end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kuroko2-0.2.1 | lib/kuroko2/workflow/scheduler.rb |
kuroko2-0.2.0 | lib/kuroko2/workflow/scheduler.rb |