【发布时间】:2013-09-08 06:06:45
【问题描述】:
有没有办法通过“delay”方法而不是通过handle_asynchronously 来使用delayed_job 在特定时间安排作业?比如:
class.delay.method(param), :run_at => Proc.new {time}
【问题讨论】:
有没有办法通过“delay”方法而不是通过handle_asynchronously 来使用delayed_job 在特定时间安排作业?比如:
class.delay.method(param), :run_at => Proc.new {time}
【问题讨论】:
想通了。您可以通过将 run_at 作为参数传递给延迟来运行延迟作业。
class.delay(run_at: 5.hours.from_now).method(param)
【讨论】:
handle_asynchronously,它期望一个过程,您也可以在其中指定run_at 选项,但是,即使您的答案也是正确的