Sha256: 71c221eb2838afc222e01d02f81bbc2ab79b1f92fd783fcc4211292e2c667396

Contents?: true

Size: 426 Bytes

Versions: 2

Compression:

Stored size: 426 Bytes

Contents

require 'socket'
require 'json'

module Khronos
  class Scheduler

    def self.run(schedule, runner=nil)
      puts "Khronos::Scheduler#run => #{schedule.inspect}"
      schedule.update_attributes(:active => false)
      schedule.save
      runner.enqueue(schedule) if runner
    end

    def self.fetch(target_time=Time.now)
      Storage::Schedule.where(['at <= ?', target_time]).where(:active => true)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
khronos-0.1.1 lib/khronos/scheduler.rb
khronos-0.1.0 lib/khronos/scheduler.rb