Permalink
Browse files

support resque

  • Loading branch information...
labocho committed Mar 25, 2013
1 parent 42280ae commit bf6b051ddbf0e80dca770d8fad5b82ac95ebffde
Showing with 3 additions and 4 deletions.
  1. +3 −4 lib/cronie.rb
View
@@ -5,9 +5,11 @@ class Error < StandardError; end
autoload :DSL, "cronie/dsl"
autoload :Schedule, "cronie/schedule"
autoload :Task, "cronie/task"
+ @queue = :cronie
class << self
def run(time)
+ time = time.is_a?(String) ? Time.parse(time) : time
tasks.each{|t| t.do(time)}
end
@@ -25,13 +27,10 @@ def load(path)
sandbox.instance_eval File.read(path)
end
- # ===== Resque 対応ここから =====
+ # for Resque
alias_method :perform, :run
- @queue = :cronie
-
def run_async(time)
Resque.enqueue(Cronie, time)
end
- # ===== Resque 対応ここまで =====
end
end

0 comments on commit bf6b051

Please sign in to comment.