开发者

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

开发者 https://www.devze.com 2023-01-30 18:55 出处:网络
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 bette

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

精彩评论

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