开发者

Is it a good idea to use Workers for checking events?

I mean, let's say an User signs up and buy a monthly membership. Is it a good idea set a job to run in a month to see if the user renewed his membership and take appropriate actions? Is there a better or a 开发者_开发百科more "Railsy" way?


I would put it in a rake job that you execute daily (or hourly on heroku or whatever).

task :cron => :environment do
  desc "Daily and Monthly tasks tasks"

  # monthly tasks
  if Date.today.day == 1  
    puts "monthly status check - #{Time.now}"
    Rake::Task["your_task"].invoke
  end
end
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜