Created
May 25, 2010 14:15
-
-
Save coffeeaddict/413167 to your computer and use it in GitHub Desktop.
Delayed Job scheduling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make an alternative for send_later that accepts a run_at time | |
# | |
module Delayed | |
module MessageSending | |
def send_later_at(at, method, *args) | |
Delayed::Job.enqueue( | |
Delayed::PerformableMethod.new(self, method.to_sym, args), | |
0, #priority | |
at #run_at | |
) | |
end | |
end | |
end | |
# >> Time.now | |
# => Tue May 25 16:13:38 +0200 2010 | |
# >> @model.send_later_at(5.minutes.from_now, :method) | |
# => #<Delayed::Job id: 2864, priority: 0, attempts: 0, handler: "--- !ruby/struct:Delayed::PerformableMethod \nobject...", last_error: nil, run_at: "2010-05-25 14:18:43", locked_at: nil, failed_at: nil, locked_by: nil, created_at: "2010-05-25 14:13:43", updated_at: "2010-05-25 14:13:43"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment