我使用魯弗斯::計劃安排任務,代碼如下: class Scheduler
def self.run
scheduler = Rufus::Scheduler.start_new
job = scheduler.in '5s', A.new
scheduler.join
end
class A
def call(job)
我的Rails應用程序在初始化程序中用rufus-scheduler啓動了一個進程。以下是初始化程序代碼的簡化版本: # config.logger isn't available here, so we have to grab it from the Rails object
logger = RAILS_DEFAULT_LOGGER
logger.warn(Time.now.to_s